Move from Fast-CGI to PHP-FPM gets 503

Discussion in 'ISPConfig 3 Priority Support' started by jpcyrenne, Aug 13, 2024.

  1. jpcyrenne

    jpcyrenne Member HowtoForge Supporter

    Good day,

    Ref : Server: (Ubuntu 20.04.5 LTS (Focal Fossa)) ISPConfig 3.2.9p1

    When I change the configurations from Fast-CGI to PHP-FPM mode I get a 503 error.

    I looked at the Apache error.log and nothing shows up.

    I've removed a .htaccess and put a simple phpinfo() file and still get the 503.
    The settings (paths) are good in the System / Additional PHP Versions, and I see the new fields in the Option tab of the site.

    Found this in the php-fpm logs:
    root@host1:/var/log# tail -f php5.6-fpm.log
    [12-Aug-2024 21:14:08] NOTICE: ready to handle connections
    [12-Aug-2024 21:14:08] NOTICE: systemd monitor interval set to 10000ms
    [12-Aug-2024 21:29:03] NOTICE: Reloading in progress ...
    [12-Aug-2024 21:29:03] NOTICE: reloading: execvp("/usr/sbin/php-fpm5.6", {"/usr/sbin/php-fpm5.6", "--nodaemonize", "--fpm-config", "/etc/php/5.6/fpm/php-fpm.conf"})
    [12-Aug-2024 21:29:03] NOTICE: using inherited socket fd=7, "/run/php/php5.6-fpm.sock"
    [12-Aug-2024 21:29:03] NOTICE: using inherited socket fd=7, "/run/php/php5.6-fpm.sock"
    [12-Aug-2024 21:29:03] ERROR: unable to bind listening socket for address '/usr/php5.6/web2.sock': No such file or directory (2)
    [12-Aug-2024 21:29:03] ERROR: unable to bind listening socket for address '/usr/php5.6/web2.sock': No such file or directory (2)
    [12-Aug-2024 21:29:03] ERROR: FPM initialization failed
    [12-Aug-2024 21:29:03] ERROR: FPM initialization failed​

    ERROR : So obviously a php-fpm issue.

    # ls -l /usr/php5.6/
    ls: cannot access '/usr/php5.6/': No such file or directory //So no socket

    # ls -l /usr/ //(no php5.6 folder)
    total 144
    drwxr-xr-x 2 root root 61440 Aug 6 06:09 bin
    drwxr-xr-x 2 root root 4096 Apr 15 2020 games
    drwxr-xr-x 37 root root 16384 May 30 06:21 include
    lrwxrwxrwx 1 root root 24 Oct 15 2020 jk_init.ini -> /etc/jailkit/jk_init.ini
    lrwxrwxrwx 1 root root 27 Oct 15 2020 jk_socketd.ini -> /etc/jailkit/jk_socketd.ini
    drwxr-xr-x 95 root root 4096 Apr 17 06:47 lib
    drwxr-xr-x 2 root root 4096 Sep 7 2020 lib32
    drwxr-xr-x 2 root root 4096 May 30 06:21 lib64
    drwxr-xr-x 3 root root 4096 Feb 22 2023 libexec
    drwxr-xr-x 2 root root 4096 Sep 7 2020 libx32
    drwxr-xr-x 11 root root 4096 Oct 15 2020 local
    drwxr-xr-x 2 root root 20480 Jul 19 06:26 sbin
    drwxr-xr-x 227 root root 12288 Nov 29 2022 share
    drwxr-xr-x 8 root root 4096 Dec 2 2020 src

    A web2.conf file exists:
    root@host1:/etc/php/5.6/fpm/pool.d# ls -l /etc/php/5.6/fpm/pool.d/
    total 24
    -rw-r--r-- 1 root root 1308 Aug 12 21:29 web2.conf
    -rw-r--r-- 1 root root 18601 Oct 10 2020 www.conf

    # cat /etc/php/5.6/fpm/pool.d/web2.conf
    [web2]

    listen = php5.6/web2.sock
    listen.owner = web2
    listen.group = www-data
    listen.mode = 0660

    user = web2
    group = client0

    pm = ondemand
    pm.max_children = 10
    pm.process_idle_timeout = 10s;
    pm.max_requests = 0

    chdir = /
    ...


    Could you please recommend a way to troubleshhot and fix this?
    (The same working site from Fast-CGI to PHP-FPM)

    Thanks ahead,
    JP
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Is PHP 5.6 an additional PHP version under system > PHP versions? If yes, ensure the optional socket directory field there is empty, most likely you entered there "php5.6" now, which is not valid as a socket directory. Empty that field now, then switch this site's PHP mode back to fastcgi, save, and switch back to php-fpm.
     
  3. jpcyrenne

    jpcyrenne Member HowtoForge Supporter

    You were right (and know your stuff!). I had put php5.6 in the optional socket directory field...
    All good now (with a service restart).

    FYI
    When I went back to Fast-CGI (wait for the site to work) and go again to PHP-FPM I still kept getting 503s (tried this twice with no success).

    I didn't see anything in the # tail -f php5.6-fpm.log (only yesterday's socket error, nothing new)
    I dont see anything in the # tail -f error.log
    I dont see anything in the # tail -f apache2/access.log

    So,
    after checking
    # service php5.6-fpm status

    I had to restart it manually (didn't seem to work with ISPConfig by switching from CGI/ tp FPM/)
    # service php5.6-fpm stop
    # service php5.6-fpm start

    Thanks again,
    JP
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    This indicates that you manually started it initially the wrong way. ISPConfig restarts the service using systemctl on recent systems, but if you manually started it using a init script, then systemctl is not able to restart it. So, this is not an ISPConfig issue; it's an issue when one mixes the init script with systemctl on recent setups. Today, you should always use systemctl to manage and start/stop services. Using the service command is ok, as it defaults to systemctl too. But do not use any init scripts if they are still there.
     
  5. jpcyrenne

    jpcyrenne Member HowtoForge Supporter

    OK. No harm intended, just an FYI. I love ISPConfig!
    Thanks for your help and support, as always.
    JP
     

Share This Page