سؤال

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