Question

This works, so exec function is not disabled.

exec('ls');

This doesn't work even thought script.php has 777 chmod.

exec('php script.php');

This doesn't work either.

exec('php -v');

I tried to chmod and chown /var/www/ folder, but it doesn't help. I suppose this is due to the www-data user permissions, looks like it doesn't have access to several bin files.

How can I solve this?

Était-ce utile?

La solution

try

which php 

and then get the path and put it in exec() like

exec("/opt/local/bin/php -v");

Autres conseils

try php -f script.php

Im not 100% sure this is correct, but i've always sent the -f flag when passing in a file.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top