Debian 10->11-> 12 upgrade dropped the default PHP to 5.6

Discussion in 'General' started by linus, Jul 3, 2024.

  1. linus

    linus Member

    After the recent Debian 10->11-> 12 upgrade ( noticed on phpmyadmin and /var/www/html) dropped to 5.6.
    The phpmyadmin is in /usr/share/phpmyadmin
    Browsing shows:
    PHP 7.2.5+ is required.
    Currently installed version is: 5.6.40-0+deb8u12

    Before the upgrade it worked and run ispconfig_update --force and I've reconfigured services a couple of times.

    From the phpinfo:
    Server Root /etc/apache2
    Loaded Modules core mod_so mod_watchdog http_core mod_log_config mod_logio mod_version mod_unixd mod_access_compat mod_actions mod_alias mod_auth_basic mod_auth_digest mod_authn_core mod_authn_file mod_authz_core mod_authz_host mod_authz_user mod_autoindex mod_dav mod_dav_fs mod_deflate mod_dir mod_env mod_expires mod_fastcgi mod_fcgid mod_filter mod_headers mod_include mod_mime prefork mod_negotiation mod_passenger mod_php5 mod_proxy mod_proxy_http mod_python mod_reqtimeout mod_rewrite mod_setenvif mod_socache_shmcb mod_ssl mod_status mod_suexec

    Configuration File (php.ini) Path /etc/php5/apache2
    Loaded Configuration File /etc/php5/apache2/php.ini
    System Linux 6.1.0-22-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.94-1 (2024-06-21) x86_64

    upload_2024-7-3_13-58-55.png

    update-alternatives:
    * 10 /usr/bin/php8.2 82 manual mode
    * 8 /usr/bin/php-cgi8.2 82 manual mode
    * 8 /run/php/php8.2-fpm.sock 82 manual mode

    # a2enconf php8.2-fpm
    Conf php8.2-fpm already enabled

    I tried running (from a similar post on the forum from 2022)
    # a2enmod mpm_event http2
    Considering conflict mpm_worker for mpm_event:
    Considering conflict mpm_prefork for mpm_event:
    Enabling module mpm_event.
    Module http2 already enabled
    To activate the new configuration, you need to run:
    systemctl restart apache2

    # systemctl restart apache2

    Job for apache2.service failed because the control process exited with error code.
    See "systemctl status apache2.service" and "journalctl -xeu apache2.service" for details.
    AH00013: Pre-configuration failed

    I since then changed back to
    # a2enmod mpm_prefork

    I have also restarted apache2.
    What else could I look for?
     
    Last edited: Jul 3, 2024
  2. pyte

    pyte Well-Known Member HowtoForge Supporter

    Disable the mod_php5 module

    Code:
    sudo a2dismod php5
     
  3. linus

    linus Member

    Apache won't start. Is there anything else that should be done in combination? Perhaps a --force upgrade?
    # a2dismod php5
    Module php5 disabled.
    To activate the new configuration, you need to run:
    systemctl restart apache2

    # systemctl restart apache2
    Job for apache2.service failed because the control process exited with error code.
    See "systemctl status apache2.service" and "journalctl -xeu apache2.service" for details.
    root@ha1:~# journalctl -xeu apache2.service
    Jul 03 15:06:00 apachectl[3871258]: Action 'start' failed.
    Jul 03 15:06:00 apachectl[3871258]: The Apache error log may have more information.
    Jul 03 15:06:00 systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
     
  4. pyte

    pyte Well-Known Member HowtoForge Supporter

    Most likely there is php5 somewhere in use in one of the configs at /etc/apache2/conf-enabled or /etc/apache2/sites-enabled.
    Check with a configtest to see what causes the issue.

    Code:
    apachectl configtest
     
  5. linus

    linus Member

    Thank you. From the ispconfig panel it seems several old sites use fast cgi 5.6, but should I look for mod 5.6 and replace them before I attempt to remote and restart it again or can't there be any sites using 5.6 at all?
     
  6. pyte

    pyte Well-Known Member HowtoForge Supporter

    If you need php5 re-enable the module.

    Then edit /etc/apache2/conf-available/phpmyadmin.conf and add this include line:

    Code:
    <Directory /usr/share/phpmyadmin>
     Options FollowSymLinks
     DirectoryIndex index.php
     AllowOverride All
    
    include /etc/apache2/conf-available/php8.2-fpm.conf
    Then restart apache2. This should then use php8.2 for phpmyadmin.
     
  7. linus

    linus Member

    apache restarted fine, but the phpmyadmin still shows php5.6.

    It looks like this now:
    cat /etc/apache2/conf-available/phpmyadmin.conf
    Code:
    # phpMyAdmin default Apache configuration
    
    Alias /phpmyadmin /usr/share/phpmyadmin
    
    <Directory /usr/share/phpmyadmin>
        Options SymLinksIfOwnerMatch
        DirectoryIndex index.php
        include /etc/apache2/conf-available/php8.2-fpm.conf
        # limit libapache2-mod-php to files and directories necessary by pma
        <IfModule mod_php7.c>
            php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
            php_admin_value open_basedir /usr/share/phpmyadmin/:/usr/share/doc/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/:/usr/share/javascript/
        </IfModule>
    
        # PHP 8+
        <IfModule mod_php.c>
            php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
            php_admin_value open_basedir /usr/share/phpmyadmin/:/usr/share/doc/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/:/usr/share/javascript/
        </IfModule>
    
    </Directory>
    
    # Disallow web access to directories that don't need it
    <Directory /usr/share/phpmyadmin/templates>
        Require all denied
    </Directory>
    <Directory /usr/share/phpmyadmin/libraries>
        Require all denied
    </Directory>
     
  8. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    I am not so well versed in apache2 but they look good to me. There is another way suggested which I found when googling around which may be you wanna try. Again, not sure if it is good.
    Code:
       <FilesMatch \.php$>
       SetHandler "proxy:unix:/var/run/php/php8.3-fpm.sock|fcgi://localhost/"
       </FilesMatch>
    
    I suggested the latest php supported by PMA which is php8.3 if you have it installed, though you may also stick to default php8.2 if you want to.
     
    linus likes this.
  9. linus

    linus Member

    Thank you, it worked for phpmysql!
    I also had to enable a2enmod proxy_fcgi (a2enmod proxy was already) for it to work.
    What I still really don't understand is why the default settings det by update-alternatives didn't do anything.
     
  10. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    That is what you have to find out. Good luck.
     
  11. Taleman

    Taleman Well-Known Member HowtoForge Supporter

  12. linus

    linus Member

  13. pyte

    pyte Well-Known Member HowtoForge Supporter

    I think the correct way is to remove mod_php5 and use php5.6-fpm instead for webspaces that need version 5. My understanding is that when mod_php5 is loaded it is the default for all webspaces when nothing else is specified for the webspace in the virtual host - this goes for any version that is set libapache2-mod-phpX package and was enabled with a2enmod phpX.
     

Share This Page