Thursday, February 1, 2018

PHP 5.4 5.5 5.6 Nginx PHP5-FPM - 502 Bad Gateway Issue Solved

I have been battling this issue:

PHP 5.4 5.5 5.6 Nginx PHP5-FPM - 502 Bad Gateway Issue Solved

for several days.  Here are the symptoms:

When you execute a PHP script it does not show any output on the browser, just WHITE PAGE!

In the Nginx log you will see error log like this:

2018/02/01 12:56:18 [error] 16526#16526: *122 readv() failed (104: Connection reset by peer) while reading upstream, client:

In the PHP FPM log you will see error log like this:

[pool www] child 21970 exited on signal 11 (SIGSEGV) after 57.041592 seconds from start

This was very difficult to troubleshoot because I literally was getting no useful clue of what is happening.

I tried to upgrade my outdated PHP from 5.4.x to 5.6 but unsuccessful because my Ubuntu server version was so old (12.04 LTS Precise Pangolin) :-(

So I dediced to keep troublshotting by process of elimination.

The breakthrough came when I disabled X-Cache extension!  After disabling X-Cache my script WORKS!

At first to test I just removed all the content of the xcache module/extension. Mine was located in:

/etc/php5/conf.d/20-xcache.ini

(I emptied the file) then executed:

service php5-fpm restart


Evidently there was some kind of incompatibility or issue which happened with some other things being upgraded overtime. So I decided to just remove X-Cache all together using this command:

apt-get remove php5-xcache

service php5-fpm restart


Now all my problems have been resolved and I am happy this issue is solved!

No comments:

Post a Comment