Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am getting constantly high and wildly fluctuating CPU usage % for php-cgi commands as seen via "top" on my Centos server..

I have a server density account and it seems that this is a common trend:

User - PID - CPU % - MEM % - VSZ - RSS - TT - Stat - Started - Time - Command

500 - 6389 - 22.4 - 3 - 271136 - 32380 - ? - S - 20:26 - 0:40 - /usr/bin/php-cgi

Seems there are about 6 or so of those records in my processes list at any given check-in.

Any ideas what's causing this? I have fast_cgi installed and the module is loading.. Not sure why it isn't handling this though.

Any help would be greatly appreciated!


share|improve this question
up vote 3 down vote accepted

php-cgi is responsible for actually running all your code. It's very normal to see these taking up resources all the time. If you're not seeing additional traffic to your website, this may be an indication that you have gotten hacked (people sending large amounts of spam or DDoS attacks via a compromised webserver will use lots of CPU).

I would suggest you stop using php-cgi and switch over to PHP-FPM. This would give you better visibility into what exactly is going on. It can also make things more efficient, as PHP-FPM workers can share one instance of an APC cache, while this may not be the case depending on how your php-cgi installation is configured. PHP-FPM also lets you enable the 'slow log', which captures a snapshot of what exactly is executing whenever a request takes longer then X seconds. This is very helpful for troubleshooting poor performance.

share|improve this answer

php-cgi handles the fcgi requests. So it probably means that your PHP is doing some processing. One PHP process can easily go to 100% for some requests on some hardware (I know from my bad server). You should watch if this matches with your requests and and examine them.

share|improve this answer
It definitely doesn't. Traffic is actually quite a bit lower today. Any idea how I can track down exactly what script is causing this load? – Ryan Thompson Jun 21 '12 at 3:56
I just scaled up too. I didn't think I needed too but took my supports word on it. Nothin.. I doubled in size to a 2GB cloud.. Been doing just fine with less than 1GB. Not crazy traffic you know? – Ryan Thompson Jun 21 '12 at 4:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.