PHPMyadmin broken, syntax error

Discussion in 'ISPConfig 3 Priority Support' started by Taleman, Dec 31, 2020.

  1. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    This is ISPConfig 3.1.15p3 host, upgraded yesterday from Debian 9 to Debian 10. PHPMyAdmin is installed from buster-backports, version 4:4.9.7+dfsg1-1~bpo10+1. Originally host was installed as Debian 8 years ago. I checked with Perfect Server Guide for Buster and remembered to force reconfigure services.
    Websites work and ISPConfig Panel is OK, but phpmyadmin does not start. It shows HTTP ERROR 500 and apache error log shows
    Code:
    PHP Parse error:  syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE) in /usr/share/php/PhpMyAdmin/MoTranslator/Translator.php on line 58
    I suspect phpmyadmin is running on PHP version older than PHP 7.1 . I do not know why this would be the case,
    Code:
    # update-alternatives --config php-cgi
    There are 5 choices for the alternative php-cgi (providing /usr/bin/php-cgi).
    
      Selection    Path                 Priority   Status
    ------------------------------------------------------------
      0            /usr/bin/php-cgi7.3   73        auto mode
      1            /usr/bin/php-cgi5.6   56        manual mode
      2            /usr/bin/php-cgi7.0   70        manual mode
      3            /usr/bin/php-cgi7.2   72        manual mode
    * 4            /usr/bin/php-cgi7.3   73        manual mode
      5            /usr/bin/php5-cgi     50        manual mode
    
    Also --config php shows version 7.3.
    But when I run the htf-common-issues.php it shows
    Code:
    ##### VERSION CHECK #####
    
    [INFO] php (cli) version is 7.3.25-1+0~20201130.73+debian10~1.gbp042074
    [INFO] php-cgi (used for cgi php in default vhost!) is version 5.6.40-0+deb8u2
    
    ##### PORT CHECK #####
    What is it that makes php-cgi still be PHP 5.6?
     
    ahrasis likes this.
  2. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Have you done a ISPConfig update and reconfigured your services? You can update to 3.1.1p3 ofcourse, but it would be better to upgrade to 3.2.1 ;)
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    Is this an apache web server? If yes, then phpmyadmin runs under mod_php, so you'll have to check which php version for mod_php is installed and change that, the update-alternatives command you used is just the one for php cgi.
     
  4. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Web server is apache.
    Several versions of mod-php:
    Code:
    # dpkg --list | grep libapache2-mod-php
    ii  libapache2-mod-php                2:7.4+79+0~20201210.30+debian10~1.gbpedaf15                              all          server-side, HTML-embedded scripting language (Apache 2 module) (default)
    ii  libapache2-mod-php5               5.6.40+dfsg-0+deb8u2                                                     amd64        server-side, HTML-embedded scripting language (Apache 2 module)
    ii  libapache2-mod-php7.0             7.0.33-37+0~20201103.43+debian10~1.gbp25a3d7                             amd64        server-side, HTML-embedded scripting language (Apache 2 module)
    ii  libapache2-mod-php7.2             7.2.34-8+0~20201103.52+debian10~1.gbpafa084                              amd64        server-side, HTML-embedded scripting language (Apache 2 module)
    ii  libapache2-mod-php7.3             7.3.25-1+0~20201130.73+debian10~1.gbp042074                              amd64        server-side, HTML-embedded scripting language (Apache 2 module)
    ii  libapache2-mod-php7.4             7.4.13-1+0~20201130.33+debian10~1.gbpd59941                              amd64        server-side, HTML-embedded scripting language (Apache 2 module)
    
    Some of the websites on this host use PHP 5.6, so I try to keep 5.6 and just make phpmyamin use PHP 7.3 for example.
     
  5. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    I do not know how to repair apache so it stops using the old PHP. I think it may have used PHP 5.6 the whole time host was running Debian 9 Stretch.
    Code:
    ##### RUNNING SERVER PROCESSES #####
    
    [INFO] I found the following web server(s):
            Unknown process (fcgi-pm) (PID 3213)
    
     
  6. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Got PHPMyAdmin working. What I did:
    Code:
    # a2dismod php7.0
    # a2enmod php7.3
    # systemctl restart apache2
    It looks to me the upgrade process from Debian 9 to 10 does not handle PHP properly. Maybe it is on purpose that old PHP is kept running to not break existing applications. I must bug someone who knows PHP stuff to write about this in next Release Notes.
    However, from htf_report
    Code:
    ##### VERSION CHECK #####
    
    [INFO] php (cli) version is 7.3.25-1+0~20201130.73+debian10~1.gbp042074
    [INFO] php-cgi (used for cgi php in default vhost!) is version 5.6.40-0+deb8u2
    
    ##### PORT CHECK #####
    
    
    ##### MAIL SERVER CHECK #####
    
    
    ##### RUNNING SERVER PROCESSES #####
    
    [INFO] I found the following web server(s):
            Apache 2 (PID 7649)
    
    still shows php-cgi is 5.6. Where is this coming from?
     
    ahrasis likes this.
  7. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    You can (probably should) just uninstall all mod_php versions, then a2enconf the php-fpm version you want to be your default php interpreter (for phpmyadmin, etc.). This is actually a requirement if you want to have the faster http2 protocol available for your sites (along with disabling mod_prefork and enabling mod_event). (I would even recommend updating Perfect Server guides to instruct doing exactly this.)

    I haven't checked the code, but if update-alternatives shows a different default, I'd guess this comes from System > Server Config > Web > PHP Settings. Those settings do not get automatically updated with an OS version update (not yet; there is an rfe to do so).
     
    Taleman and ahrasis like this.

Share This Page