how to view all the php processes running? i need to see the example.php files names something like cpanel has: http://docs.cpanel.net/twiki/bin/view/AllDocumentation/WHMDocs/CurrentRunning
I'd just do something like this: <?php $strOutputArray = array(); $strProcessArray = explode("\n", trim(`ps -ef`)); for ($i = 0; $i < sizeof($strProcessArray); $i++) { if ($i == 0) $strFieldNameArray = preg_split("#[[:space:]]+#", $strProcessArray[$i]); else { $strFieldValueArray = preg_split("#[[:space:]]+#", $strProcessArray[$i]); $strOutputArray[$i - 1] = array(); for ($j = 0; $j < sizeof($strFieldNameArray); $j++) $strOutputArray[$i - 1][$strFieldNameArray[$j]] = @$strFieldValueArray[$j]; } } echo '<pre>' . print_r($strOutputArray, true) . '</pre>'; Code (markup):
Use ps - its the same as what WHM uses. You can also use "top" if you want to interactively monitor current processes. If in doubt, "man ps" will give you the syntax you need to follow However, you should also bear in mind that PHP will not run as a process (unless its CLI) as it will be invoked from apache, or your web server
the problem with ps and top is that i get just something like this: 15414 ? 00:00:00 php-cgi 15416 ? 00:00:00 php-cgi 15417 ? 00:00:00 php-cgi 15418 ? 00:00:00 php-cgi 15419 ? 00:00:00 php-cgi 15420 ? 00:00:00 php-cgi 15421 ? 00:00:00 php-cgi 15422 ? 00:00:00 php-cgi 15423 ? 00:00:00 php-cgi 15424 ? 00:00:00 php-cgi 15425 ? 00:00:00 php-cgi 15426 ? 00:00:00 php-cgi 15427 ? 00:00:00 php-cgi 15428 ? 00:00:00 php-cgi 15429 ? 00:00:00 php-cgi 15430 ? 00:00:01 php-cgi 15431 ? 00:00:00 php-cgi 15432 ? 00:00:00 php-cgi 15433 ? 00:00:01 php-cgi 15434 ? 00:00:00 php-cgi 15435 ? 00:00:00 php-cgi 15436 ? 00:00:00 php-cgi 15437 ? 00:00:06 php-cgi 15439 ? 00:00:06 php-cgi 15440 ? 00:00:06 php-cgi 15441 ? 00:00:06 php-cgi 15442 ? 00:00:06 php-cgi 15443 ? 00:00:00 php-cgi 23858 ? 00:00:05 php-cgi but i want to see which .php files are running. :S any ideas?
Setup a MySQL database and create a memory table? You could insert when the user starts a page execution and have the record removed when it's done being executed. It might take a small performance hit (and fill up your memory really fast if you have a high amount of traffic and low memory), but you can't see what specific pages are running explicitly through PHP.