I just upgraded php-fpm and my server has gone away with a 502 bad gateway I've been searching for solutions and came across some like this:


and this

Getting 502 bad gateway after updating php to 5.5

But with no luck. I've changed fastcgi_pass from a unix socket to and in the php pool listen = But I keep getting the 502

Here are my config files:

In the nginx config:

upstream php {
       #server unix:/var/run/php-fpm.socket;

And later on my site config I have:

fastcgi_pass php;

In my php pool:

listen =

Some error logs from nginx log

 2015/03/23 10:38:48 [error] 14365#0: *485 recv() failed (104: Connection reset by peer) while reading response header from upstream, client:, server: elbauldelprogramador.com, request: "GET /tag/configurar-prefetch-windows-8/ HTTP/1.1", upstream: "fastcgi://", host: "elbauldelprogramador.com"

I've also noticed this warning in php logs:

[23-Mar-2015 12:38:59] WARNING: [pool www] child 33877 exited with code 127 after 5.620225 seconds from start

After searching a bit more, it seems that the problem is in swaping php workers, I do not know what means the error code 127, but when the server was running it always was 0.

If you need more config files, please tell me.

  • 502 could be an error in php, or php-fpm is not running
    – ADM
    Mar 23, 2015 at 10:48
  • Yes, it is, but I can not solve it. Mar 23, 2015 at 10:49
  • Is this useful?
    – Halfgaar
    Mar 23, 2015 at 12:44
  • I've solved the problem, it was apc. I will post the answer in two days Mar 23, 2015 at 12:48
  • 1
    Sorry!, the restriction is for “acepting” the answer, not for posting it. sorry for the misunderstanding, Mar 23, 2015 at 16:01

1 Answer 1


I've found the root cause of the problem. After the php update, the apc extension I have in my php.ini was no longer working, all its all right now after commenting this line:


Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.