linux - php shell_exec can't return "pidof php" on CentOS

612

I am using shell_exec command to get the back end processes of PHP. Like:

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

If I run"pidof php" from command console as root, it gives me the correct result. I'm usingPHP 5.5 andCentOS 6.5.

What additionally I need to do to get the processes?

N.B: If I run the file from command line, it gives me the correct result. But the same file when running from browser, can't return the processes.

People are also looking for solutions to the problem: php - Symfony2 web debug toolbar (404 not found)

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.