title: How long will a running PHP process get stuck while piling up server's CPU load
body: <p>It's already several weeks since occasionaly all 8 CPU cores on server machine got almost to 100% load because of the Apache processes (just Apache, there are no other high-load processes except MySQL).</p>
  
  <p>Restarting Apache always works but usually just for couple hours but once it was even a week. There's no visible pattern. Overall load gets to around 10 but the machine is still respondinng very quickly (usually it's floating from 1 to 4 or 6 tops, depends on daytime). But there is no connection between these never-ending spikes and actual server stress caused by visits or cron jobs. It seems pretty random, so my best guess is a faulty PHP script cycling over and over doing god knows what.</p>
  
  <p>If nothing else, such a useless load is heating up the CPU, shortening his lifetime and who knows how many resources are spent by this PHP process I can't identify.</p>
  
  <p>All the PHP processes are wrapped by Apache processes, so I can't actually see which PHP scripts are currently running in the UNIX process list. Is there any other way around to point to specific script? Other than implement some kind of tracking code inside every PHP script? I'm not running webhosting but there is more than one site and I don't see how could I implement a tracking code in such an extensive code spread across the webserver.</p>
  
  <p>Therefore I'm looking for pure unix solution (Debian). In worst case it would point me to PHP script which includes dozens of PHP classes and contollers. In the best case it would be some simple script. Either way, it's a start. I think.</p>