Fix 502 Bad Gateway & php5-fpm/ispconfig.sock failed errors when updating php

Discussion in 'Suggest HOWTO' started by tahunasky, Feb 11, 2019.

  1. tahunasky

    tahunasky Member

    I have some servers running ubuntu 14.04 and php 5.5.
    Some software that I use has been updated and requires php 5.6 or better, so decided I would go to php 7.1.
    I did a new install of ubuntu 14.04 from a guide on here, but I needed to add the respository for php 7.1, and also for nginx to get latest version of that too.

    Code:
    root@kia:~# add-apt-repository ppa:ondrej/php
    root@kia:~# add-apt-repository ppa:ondrej/nginx
    I then installed the latest stable ispconfig as per the guide.

    ispconfig wouldn't start, with the errors "502 Bad Gateway" showing in the browser and "unix:/var/lib/php5-fpm/ispconfig.sock failed (2: No such file or directory)" in the nginx/error.log.
    After searching for a solution without luck, and seeing some people had just given up, spent time to figure it out for anyone else with the same issues.

    So this is whats needed to be done.

    Copy ispconfig.conf and apps.conf from /etc/php5/fpm/pool.d into /etc/php/7.1/fpm/pool.d
    Restart both nginx and php7.1-fpm
    Code:
    root@kia:~# service nginx restart
    root@kia:~# service php7.1-fpm restart
    In ISPCONFIG goto:
    SYSTEM/TOOLS/SERVER CONFIG/WEB/PHP SETTINGS
    PHP-FPM php.ini path:
    change from /etc/php5/fpm/php.ini to /etc/php/7.1/fpm/php.ini

    PHP-FPM pool directory:
    change from /etc/php5/fpm/pool.d to /etc/php/7.1/fpm/pool.d

    PHP-FPM socket directory
    change from /var/lib/php5-fpm to /var/run/php

    In /etc/nginx/sites-available ispconfig.vhost & apps.vhost

    change from fastcgi_pass unix:/var/lib/php5-fpm/apps.sock; to fastcgi_pass unix:/var/usr/php/apps.sock;
    change from fastcgi_pass unix:/var/lib/php5-fpm/ispconfig.sock; to fastcgi_pass unix:/var/run/php/ispconfig.sock;

    Restart both nginx and php7.1-fpm again
    Code:
    root@kia:~# service nginx restart
    root@kia:~# service php7.1-fpm restart
    This should work for any version you decide to installed. I went with php 7.1 as it has php7.1-mcrypt which php 7.2 doesnt yet have.
     
    Last edited: Feb 11, 2019
    ahrasis and zenny like this.

Share This Page