user3171362
user3171362

Reputation: 51

exec() PHP not working in browser but working ok in terminal

I am trying to do the following in my php file:

exec("java -jar /Applications/XAMPP/htdocs/Web/SimpleEncryption.jar hola", $output);

I get array(0) { }

If I execute php file.php in the terminal it works.

If I run

exec("whoami", $result);

I get Array ( [0] => daemon ) in the browser and Array ( [0] => dao ) in the terminal. dao=my user.

I don't know what permissions I have to give and how to give them.

Thanks

Upvotes: 1

Views: 1848

Answers (1)

bspates
bspates

Reputation: 412

It is probably that the username of the php server process is not your username. When you run it from the terminal you are logged in as dao, but the php process served up by your webserver is under a different username. If you are using php-fpm the username is specified in the conf file.

Upvotes: 1

Related Questions