我使用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.5
和CentOS 6.5
。
我还需要做些什么才能获得流程?
N.B:如果我从命令行运行该文件,它会给我正确的结果。但是从浏览器运行时,同一个文件无法返回进程。