PHP 7.0 upgrade and “502 Bad Gateway”

Short one, and mainly for my own reference.

I’d installed PHP 7.0. Updated the nginx config files to use php7.0-fpm.sock. Changed the PHP user. Everything *looked* like it should work, but I was eating gateway errors.

PHP 7 - 502 Bad Gateway

Turns out the default “listen” path had slightly changed in PHP 7.0 (/run/php/php7.0-fpm.sock instead of /var/run) and I’d missed it, so all my nginx entries were now pointing to a non-existent path to the socket. Rather than go through nginx and change them all yet again, the easy method is to just edit /etc/php/7.0/fpm/pool.d/www.conf and change the listen path there.

1 Comment

 | Leave a Comment
  1. Thanks, you saved my life

Leave a Comment

You can use an alias and fake email. However, if you choose to use a real email, "gravatars" are supported. You can check the privacy policy for more details.

To reduce spam, I manually approve all comments, so don't panic if it looks like the page simply refreshed and your comment doesn't show up immediately.