<p>In php, how can I get the number of apache children that are currently available <br>(<code>status = SERVER_READY</code> in the apache scoreboard)?</p>

<p>I'm really hoping there is a simple way to do this in php that I am missing.</p>

[{'answer_id': 67832, 'author': 'ceejayoz', 'author_id': 1902010, 'author_profile': 'https://Stackoverflow.com/users/1902010', 'pm_score': 2, 'selected': False, 'text': "<p>You could execute a shell command of <code>ps aux | grep httpd</code> or <code>ps aux | grep apache</code> and count the number of lines in the output.</p>\n\n<pre><code>exec('ps aux | grep apache', $output);\n$processes = count($output);\n</code></pre>\n\n<p>I'm not sure which status in the status column indicates that it's ready to accept a connection, but you can filter against that to get a count of ready processes.</p>\n"}, {'answer_id': 67990, 'author': 'giltotherescue', 'author_id': 8215, 'author_profile': 'https://Stackoverflow.com/users/8215', 'pm_score': 1, 'selected': False, 'text': '<p>If you have access to the Apache server status page, try using the ?auto flag:</p>\n\n<p><a href="http://yourserver/server-status?auto" rel="nofollow noreferrer">http://yourserver/server-status?auto</a></p>\n\n<p>The output is a machine-readable version of the status page. I <em>believe</em> you are looking for "IdleWorkers". Here\'s some simple PHP5 code to get you started. In real life you\'d probably want to use cURL or a socket connection to initiate a timeout in case the server is offline.</p>\n\n<pre><code>&lt;?php\n\n$status = file(\'http://yourserver/server-status?auto\');\nforeach ($status as $line) {\n  if (substr($line, 0, 10) == \'IdleWorkers\') {\n    $idle_workers = trim(substr($line, 12));\n    print $idle_workers;\n    break;\n  }\n}\n\n?&gt;\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/67819', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']