Search code examples
phpnginxfpmlaravel-5.6php-7.2

502 Bad Gateway when installing PHP7.2 on nginx


So i installed LEMP (nginx, mysql, php..) by following the digital ocean guide. But ubuntu 16.04 only comes with php7 by default and i need greater then 7.1 to run Laravel. I am confused on why every time i replace php 7 with php 7.2-fpm from ondrej

sudo add-apt-repository ppa:ondrej/php

Why does the default php-fpm work and load the info.php page.. but when i install php 7.2-fpm from ondrej it shows up 502 bad gateway. Any help is appreciated so i can start Laravel! :D


Solution

  • I had same problem, so I changed the nginx config file /etc/nginx/sites-avaiable/your-site.

    Change:

    fastcgi_pass unix:/run/php/php7.1-fpm.sock;
    

    to

    fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    

    This worked for me.