PHP Crashes server

I had this issue for a long time where php spawns unlimited processes untill the server crashes. I tried playing around with the httpd maxclients and PHP_FCGI_CHILDREN in php5.fcgi but none of this had any effect.

This happens around 4 times per day while at the rest of the day only half the ram is used. I suspect this is related to mysql where it responds to slow and php goes berzerk on it or something.

My server is a dual core 3GB ram with CentOS 6 / Virtualmin 3.88
I have the same issues on my hexacore 16GB ram CentOS 5.6 machine. This machine spawns up to 1400 php processes and then dies.

P.S i tried to attach my htop output as screenshot but it gave me a 500 error so here is a pic thats made 20 sec before a system crash.


Yeah, you definitely have quite a few PHP processes there!

I’ve actually seen issues like that during DoS attacks (or, DoS “accidents” with misbehaving bots). It looks like the majority of those PHP processes belong to the account “hentaist” – you may want to check the access logs associated with that account to see if there is one IP address that seems to be hitting the server over and over.

If so, you can firewall off the IP address.

Also, setting MaxClients in your Apache config should be a good way of resolving that… there is often more than one MaxClients parameter in the Apache config, make sure you’re editing the right one (or, better yet, just edit both :slight_smile:


Even if it was a DoS why isen’t there something i can do so my server does not crash while i’m sleeping? I already lowered MaxClients but that didn’t help me.