Different PHP versions with Sury repo

  • Some more instruction is helpful for external repositories to avoid wrong recognition of Lc internals. Apparently Lc looks at the Debian version and the expected default version (in my case Debian 11 with php 8.0). The ID used here is php8. To distinguish sury from the LC provided repos in /opt, I used a different IDs namely php80sury. This causes a confusion that created and additional php8 version with mixed erroneous paths . I did not try it but I guess that the default will then fail to work correctly.

    The only workaround I found is to follow the undocumented convention:


    1. remove all default /opt based luas; when you use external repos they are simply not needed.
    2. make your own luas and let the php 8 version have 'id' php8 . Only then the internal default recognition code is overridden. It recognises the 'id' not the PHP version.

    Here I post the still untested pattern for php8:


    This is how far I got but I see more errors. FPM seems to have become fully disconfigured. I have given up on it for lack of time. Any hints are appreciated how to get this working with fpm and sury repository. I don't mind answers in German.

  • ñull

    Changed the title of the thread from “Different PHP versions, custom repo and addPHP 'id' conventions” to “Different PHP versions with Sury repo”.
  • Mistake: Debian 11 still has php 7.4.33 as default. 8.x can only be installed with an additional PHP repository.


    I removed all php to avoid confusion between standard and Sury php. Then I reinstalled from Sury php 8. 0.x and php 8.1.x. I run and see:

    Code: bash shell
    systemctl restart liveconfig; liveconfig --diag
    
    Running OS diagnostics... (LiveConfig 2.16.0-release)
    ....
    
    Running Lua diagnostics...
    [WARNING] addPHP: incomplete FPM configuration for '/usr/sbin/php-fpm8.0' - skipping...
    [WARNING] addPHP: incomplete FPM configuration for '/usr/sbin/php-fpm8.1' - skipping...

    The warnings were for the missing ['fpm']['reload'] which I had commented out. I included it and corrected eol year:



    After Switching to FPM the affected site shows me this message when I access the site with my browser:


    Quote from php page with <?php phpinfo() ?>

    Service Unavailable

    The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

    In apache's configuration I see:


    Code: /etc/apache2/sites-available/contract-name.conf
        <IfModule mod_proxy_fcgi.c>
            <FilesMatch ".+\.ph(p[3457]?|t|tml|ps)$">
                SetHandler "proxy:unix:/run/php80-fpm/<subscription-name>.sock|fcgi://localhost"
                SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
            </FilesMatch>
        </IfModule>

    The run folder however does not exist, only /run/php. I finally made the socket folder common for all and in /run/php :

    I am not sure if that will again cause conflicts when switching versions. I experienced these when after switching php version the FPM service complained that a socket (of the previous PHP version) already existed. The old socket under the other PHP version remained active and was apparently not closed when the version change took place. I tried changing from 8.0.x to 8.1.x and sure enough I see it again after restarting:

    Quote from systemctl restart php8.0-fpm; systemctl status php8.0-fpm

    sep 06 11:58:00 hostname php-fpm8.0[767720]: [06-Sep-2023 11:58:00] ERROR: Another FPM instance seems to already listen on /run/php/<subscription-name>.sock

    sep 06 11:58:00 hostname php-fpm8.0[767720]: [06-Sep-2023 11:58:00] ERROR: FPM initialization failed

    After some time it restored itself although I doubt that 8.0.x was still working because initialization failed. This is however a client with their own dedicated server with limited damage when you are aroud to solve it. Aparently a restart like this seems to solve the issue:



    Code: bash shell
    systemctl restart php8.{0,1}-fpm.service apache2 mariadb
    systemctl status php8.{0,1}-fpm.service apache2 mariadb

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!