This works, so exec function is not disabled.
这样可行,因此不禁用exec功能。
exec('ls');
This doesn't work even thought script.php has 777 chmod.
即使认为script.php有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.
我试着chmod和chown / var / www /文件夹,但它没有帮助。我想这是由于www-data用户权限,看起来它没有访问几个bin文件。
How can I solve this?
我怎么解决这个问题?
2 个解决方案
#1
1
try
which php
and then get the path and put it in exec() like
然后获取路径并将其放在exec()中
exec("/opt/local/bin/php -v");
#2
-2
try php -f script.php
试试php -f script.php
Im not 100% sure this is correct, but i've always sent the -f flag when passing in a file.
我不是100%确定这是正确的,但我总是在传入文件时发送-f标志。
#1
1
try
which php
and then get the path and put it in exec() like
然后获取路径并将其放在exec()中
exec("/opt/local/bin/php -v");
#2
-2
try php -f script.php
试试php -f script.php
Im not 100% sure this is correct, but i've always sent the -f flag when passing in a file.
我不是100%确定这是正确的,但我总是在传入文件时发送-f标志。