php-cgi constantly recycles every couple of minutes

mindfrost82 nginx-forum at
Fri Jan 29 17:38:14 MSK 2010

So I have tried a few more different things and php-cgi is still recycling way too often in my opinion.

I tried the earlier suggestion of using 16 children (instead of 4) with 4096 max requests.  It does appear that the max requests is getting ignored completely, as Rob said.  With 16 children, the site is MUCH faster, but php-cgi is getting recycled about every minute still.  The reason I think its getting ignored is because I can set it to 1 million and it will still recycle just as often....unless there's something else causing this.

I also tried changing from TCP to a socket with the same result.  Which do you guys suggest anyway?

Whenever php-cgi recycles itself, while using TCP, I'll get these in the nginx logs:
recv() failed (104: Connection reset by peer) while reading response header from upstream
connect() failed (111: Connection refused) while connecting to upstream

I might just have to switch to php-fpm, but if there's another underlying cause here, I'm not sure if it'll matter.  Do you still have to recompile PHP to get php-fpm to work, or is there an easier way?

Posted at Nginx Forum:,45516,47247#msg-47247

More information about the nginx mailing list