开发者

shell_exec return NULL

开发者 https://www.devze.com 2023-02-21 15:46 出处:网络
when i run the code shell_exec(\'ping -c 4 127.0.0.1\') it returns NULL, but when I run the same command (ping -c 4 127.0.0.1) in ssh, it returns perfectly...

when i run the code

shell_exec('ping -c 4 127.0.0.1')

it returns NULL, but when I run the same command (ping -c 4 127.0.0.1) in ssh, it returns perfectly...

and yes, the script can run shell_exec, I tried shell_exec('ls') and it returns correctly, and shell_exec('ping -V') returns ping utility, iputils-ss020927 so ping is开发者_JS百科 being called, but I just get no response...

any help? thanks!


Solved:

Ping cannot be executed as a user. Root must run chmod +s 'type -p ping' in order for users to run ping

0

精彩评论

暂无评论...
验证码 换一张
取 消