質問

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?

役に立ちましたか?

解決

try

which php 

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

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

他のヒント

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top