PHPMyAdmin runs on old PHP 5.6 - how do I change PHP version?

Discussion in 'ISPConfig 3 Priority Support' started by Jemt, Oct 17, 2022.

  1. Jemt

    Jemt Member HowtoForge Supporter

    Hi,
    I just realized that PHPMyAdmin is running on PHP 5.6 - at least that's what the web interface says in the information panel.

    Both php and php-cgi is set to php7.3:

    Code:
    jemt@isp:~$ update-alternatives --config php
    There are 3 choices for the alternative php (providing /usr/bin/php).
    
      Selection    Path             Priority   Status
    ------------------------------------------------------------
    * 0            /usr/bin/php7.3   73        auto mode
      1            /usr/bin/php5     50        manual mode
      2            /usr/bin/php7.0   70        manual mode
      3            /usr/bin/php7.3   73        manual mode
    
    Press <enter> to keep the current choice[*], or type selection number: 
    Code:
    jemt@isp:~$ update-alternatives --config php-cgi
    There are 3 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-cgi7.0   70        manual mode
      2            /usr/bin/php-cgi7.3   73        manual mode
      3            /usr/bin/php5-cgi     50        manual mode
    
    Press <enter> to keep the current choice[*], or type selection number: 
    I installed PHPMyAdmin like described in this article:
    https://www.howtoforge.com/perfect-...stall-phpmyadmin-database-administration-tool

    How do I make it run on PHP 7.3? I plan on upgrading to PHP 8 soon, so eventually I will need to make it run on that instead.

    - Thank you :)

    Jimmy
     
  2. Jemt

    Jemt Member HowtoForge Supporter

    Here is the Apache conf file for PHPMyAdmin:
    Code:
    # phpMyAdmin default Apache configuration
    
    Alias /pma /usr/share/pma
    
    <Directory /usr/share/pma>
            Options FollowSymLinks
            DirectoryIndex index.php
    
            <IfModule mod_php7.c>
                    AddType application/x-httpd-php .php
    
                    php_flag magic_quotes_gpc Off
                    php_flag track_vars On
                    php_flag register_globals Off
                    php_value include_path .
            </IfModule>
    
    </Directory>
    
    # Authorize for setup
    <Directory /usr/share/pma/setup>
            <IfModule mod_authn_file.c>
                    AuthType Basic
                    AuthName "phpMyAdmin Setup"
                    AuthUserFile /etc/pma/htpasswd.setup
            </IfModule>
            Require valid-user
    </Directory>
    
    # Disallow web access to directories that don't need it
    <Directory /usr/share/pma/libraries>
            Order Deny,Allow
            Deny from All
    </Directory>
    <Directory /usr/share/pma/setup/lib>
            Order Deny,Allow
            Deny from All
    </Directory>
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    phpmyadmin runs on mod_php, so you have to ensure that PHP 7.3 is installed for mod_php (you can find exact PHP package name with e.g.:

    apt-cache search libapache | grep PHP

    (sorry, don't have a Debian 10 running at the moment). When the right version is installed, you'll probably have to disable the old version with a2disconf command and enable the new one with a2enconf command and then restart apache.
     
  4. Jemt

    Jemt Member HowtoForge Supporter

    Okay, I see.

    Code:
    jemt@isp:~$ apt-cache search libapache | grep -i php
    libapache2-mod-php - server-side, HTML-embedded scripting language (Apache 2 module) (default)
    libapache2-mod-php7.3 - server-side, HTML-embedded scripting language (Apache 2 module)
    php7.3-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
    libapache2-mod-php5 - server-side, HTML-embedded scripting language (Apache 2 module)
    libapache2-mod-php7.0 - server-side, HTML-embedded scripting language (Apache 2 module)
    php5-cgi - server-side, HTML-embedded scripting language (CGI binary)
    php5-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
    php7.0-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
    I do have mod-php7.3 installed:
    Code:
    root@isp:/# dpkg --get-selections | grep -i libapache2-mod-php
    libapache2-mod-php                              install
    libapache2-mod-php5                             install
    libapache2-mod-php7.0                           install
    libapache2-mod-php7.3                           install
    You mention the use of a2enconf and a2disconf - but libapache2-mod-phpXX are modules, right? So shouldn't it be a2enmod and a2dismod?
    I would guess this would be the solution - am I right or wrong here?
    Code:
    a2dismod php5
    a2enmod php7.3
    apache2ctl restart
    If my suggestion above is correct, will it affect our ISPConfig environment in any way?
    I would expect all websites to continue running on the Default PHP version set in ISPConfig - or an alternative PHP version if explicitly set for a given website.

    - Thanks again :)
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, sorry. I meant using a2enmod and a2dismod

    If you run any websites with mod_php mode, they get the new PHP version as well. But most likely you use php-fcgi or php-fpm anyway for sites, so a change of mod_php will have no side effects.
     
  6. Jemt

    Jemt Member HowtoForge Supporter

    Excellent. Thanks a lot @till :)
     

Share This Page