Ubuntu 11.10 PHP5 Bug
19 Jan 2012 by TuxAdminThis post is intended for both LAMP and LNMP users running on Ubuntu 11.10.
If your VPS or server is continuously experiencing high CPU usage, it is likely due to a PHP5 bug.
Fortunately, the fix is fairly simple and involves commenting out and replacing a single line. First open the PHP5 cron file with your favourite editor:-
nano /etc/cron.d/php5
Comment out the existing "09,39" line by adding a hash "#" in front of it. Then append the following line to the cron file:-
09,39 * * * * root [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) -delete
Finally, reboot your server to clear off all the queued processes.
I'm surprised this hasn't been fixed by Ubuntu's PHP5 team yet, since it is a confirmed bug reported over 3 months ago. For those interested, here are the links to the bug reports:-
https://bugs.launchpad.net/ubuntu/+source/php5/+bug/877894
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=633100
Thanks to those who emailed to alert me about the high CPU usage when using Ubuntu 11.10!