Php-cgi Gone Mad

This (see image below) is currently what my top output on my web server looks like, and it’s horrible.  I need to figure out why there are so many php-cgi processes running and why they’re eating so much memory.  My server has 512 MB of ram which should be more than enough with Nginx to run WordPress.  Time to do some digging…

top_output_php-fcgi

(Update 1/17/2013 1:31AM) – Turns out to be a configuration option in the service startup script in /etc/init.d/, chosen by parameter: “PHP_FCGI_CHILDREN=X” where X is the number of children processes to create. This number was originally at 15, probably a default number or something I saw when originally setting up the server and adding it in there.  I have since changed that to 4 and have had much better response times with my server as its memory isn’t being eaten away.

I came across this post while doing a quick search just to get extra information.  I didn’t use what the author suggested, however it might be something good to know for later.