Nginx + PHP FASTCGI FAILS - how to debug ?

Don Burris lists at
Mon Jun 21 01:29:14 MSD 2010

Usu wrote:
> Hi, I'm having the same problem for a few weeks now, after x hours/days 
> php becomes unresponsive, I've already changed 2 different php-fastcgi 
> spawning scripts and tried php-fpm as well, switched between many 
> version of the php 5.2 and 5.3 branches but the problem still remains so 
> I don't think it's a php issue even if that would be the most logical 
> conclusion.
> When php becomes unresponsive (502 bad gateway error) all the 
> php-cgi/php-fpm processes are still running and I can see them in top/ps 
> aux, when I restart php everything start to work again.
> I don't know if it's releated, but while I was browsing this forum a few 
> minutes ago I got the 502 error with the same behavior it has when it 
> happens on my site, it lasted some minutes than someone took care of it. 
> Also, take a look at this discussion: 
> I think that this is a nginx bug, it would be nice if some developer 
> could look into this, I could provide error logs and such if needed, 
> just let me know, thanks!
> Posted at Nginx Forum: 

I realize you may have moved on; some time has passed since you posted 
this problem. However, I had the same issue and I was able to fix it. 
The user nginx runs as in a default setup is "www-data", or "nobody". 
Nginx has insufficient permissions to communicate with 
fastcgi:// which usually runs as root. So if you use 
spawn-fcgi, you must run it with the -U flag, and specify the same user 
that nginx runs as. For example:

spawn-fcgi -a -p 9000 -C 5 -f /usr/bin/php-cgi -U nobody

or if you use sockets

spawn-fcgi -s /var/run/fcgi.sock -C 5 -f /usr/bin/php-cgi -U nobody

My problem was identical to yours, php would work for a moment, then 
become unresponsive even though the processes were still running. I hope 
this helps, this problem was very frustrating.
Posted via

More information about the nginx mailing list