PHP-FPM + NGINX + 502 GATEWAY
February 16, 2011
Technology, nginx, PHP
OMFG, I spent hours debugging this 502 gateway error. My server is very customized in terms of the way I have my LEMP stack set up. Last night, I decided to run an apt-get upgrade on my box since it’s been awhile. I saw that there were many php packages on the list. So, I went through with it. This morning = FAIL. Woke up early to be greated by the infamous 502 Gateway error. Logs were not helpful at all. Spent hours trying to fix it. Finally got my site working again…. With the assistance of my buddy Matt D., we found the issue! I told him what was happening and he also did an upgrade to be greeted by the same error. But for him, it was APC that was causing him problems. He uninstalled APC via pecl uinstall and reinstalled it. Now, he’s good. For me, It was xdebug. I had to commented it out, restarted php-fpm and all is fine now. Hopes this helps people out there.
Edit: I was able to get xdebug to work. I did apt-get remove php5-xdebug then I made sure it wasnt installed via pecl so I ran an pecl uninstall xdebug. The I installed it via pecl install xdebug. Here’s the important part… I copied the full path to xdebug.so and put it inside my xdebug.ini file so it loads the correct one. Note to self, next time I do a PHP upgrade, check modules!