Nginx and php (fast-cgi) hangs the connection

from about month (moving to the nginx 7.61) I had a very big problem.
My server suddenly stops to serving dynamic content.
Static files are handled in regullar way but asking for php files gives
nothing in the web browser, and sometimes in the benchmarking site in ab
we receive broken sockets.
Some days ago I had moved to 7.62 and spawn-cgi 1.6.3 - then I thought
everything is solved, but I realized that site hangs in the peak of the
There is nothing in the nginx logs, nothing in php logs.
What could I do?
What could be wrong?
Could You help me somehow?

Best regards

Posted at Nginx Forum:

In my past experience usually its just because all the spawned php
are doing something (or are just some hanged state (you could use
to see what the php childs are doing at the moment nginx stops to
the php content)) and there is no free child to assign the incoming
request from nginx.

And while you may think that from php side the ini setting
‘max_execution_time’ would help it is not always the case (especially if
are dealign with sockets or other (tcp) connections within the php code)

sooner or later all the childs are being used and no new spawned.

The thing to do would be instead of spawn-cgi use php-fpm

While it involves patching php (then again it is planned to implement as
core in future php releases (there is even a seperate branch in
svn)) it gives you the possibility
monitor ( request_slowlog_timeout ) and kill ( request_terminate_timeout
the php processes which take too long to finish.

Has helped me a lot to find site bottlenecks and point those out to
development team.


----- Original Message -----
From: “yacenty” [email protected]
To: [email protected]
Sent: Thursday, October 15, 2009 8:45 PM
Subject: nginx and php (fast-cgi) hangs the connection

is it a good idea to switch to different solution if the server is not
stable now?
I’m really afraid of this step

Posted at Nginx Forum:

What do you mean by ‘not stable’?
Your nginx error log (or php error log in case its some fatal php error
display_errors is set to false) should show why are there blank pages on
dynamic content requests (like fastcgi upstream taking too long to
respond).Anyways most likely your problems have no direct relation to
at all rather then the php fastcgi childs.

And people do switching just because the current solution for some
(bugs / too complex / missing features etc) doesnt work.


----- Original Message -----
From: “yacenty” [email protected]
To: [email protected]
Sent: Friday, October 16, 2009 12:57 AM
Subject: Re: nginx and php (fast-cgi) hangs the connection

could be so that You are right
reduced ammount of php processes to 3 and server hang after 30 seconds
with about 300 users online.
Then moved these ammount of processes to 100 and it’s allive
I would provide more data after “peak time”

Posted at Nginx Forum: