php shell_exec无法返回" pidof php"在CentOS上

时间:2015-10-18 10:36:22

标签: php linux centos shell-exec

我使用shell_exec命令来获取PHP的后端进程。像:

$dir = shell_exec("ls -la");  //returns directory listing
$date = shell_exec("date");  //returns date
$pid = shell_exec("pidof php"); //returns nothing !!!

如果我以root身份从命令控制台运行"pidof php",它会给我正确的结果。我使用PHP 5.5CentOS 6.5

我还需要做些什么才能获得流程?

N.B:如果我从命令行运行该文件,它会给我正确的结果。但是从浏览器运行时,同一个文件无法返回进程。

0 个答案:

没有答案