Unable to change php version in apache/phpmyadmin

Discussion in 'Server Operation' started by sjak_congnac, Feb 8, 2025.

  1. sjak_congnac

    sjak_congnac New Member

    Hello All,
    OS: ubuntu 22.04.5 LTS
    ISPconfig: 3.2.12p1
    PHPMyadmin: 5.2.2

    I have an system that when in phpmyadmin a user selects to export anything of any size an Internal error is shown. According to the users it worked in the past(i did not verify if this was true) From multiple places i consumed multiple tips and tricks in regards to phpmyadmin but none of them was providing me a solution. So i decided to compare the troublesome phpmyadmin with one that was working correctly.

    One of the differences is the version show in regards to the php version used in combination with the webserver according to the interface of phpmyadmin. I realise they use diferent Webserver, but i am focussing on the PHP version
    Not working server:
    upload_2025-2-8_6-44-29.png

    Working server:
    upload_2025-2-8_6-46-27.png

    I tried to to the following to make the Non working server to change to PHP 8.1 like the working server:
    As root in the terminal:
    Code:
    sudo update-alternatives --config php
    Now when execute
    Code:
     php -v 
    i get php version 8.1
    I restart apache2:
    Code:
     systemctl restart apache2 
    When i login to PHPmyadmin again, my settings in regards to php are not set

    I am looked the vhost of the apps and realised i need help because manually editing of ISPConfig files is not the way to go reading the stuff in this forum.

    My goals is to get phpmyadmin working but i do not have proper clues on the apache2 logs, and the phpmyadmin website that the problem i face can have many reasons which in combination without proper logging is effectively totally perfectly useless

    Added my apps vhost config:
    Code:
        Header set Content-Security-Policy "default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src * data:; object-src 'none'"
        Header set Content-Security-Policy "default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' data: *; object-src 'none'; upgrade-insecure-requests"
        Header set X-Content-Type-Options: nosniff
        Header set X-Frame-Options: SAMEORIGIN
        Header set X-XSS-Protection: "1; mode=block"
        Header always edit Set-Cookie (.*) "$1; HTTPOnly"
        Header always edit Set-Cookie (.*) "$1; Secure"
        <IfVersion >= 2.4.7>
           Header setifempty Strict-Transport-Security "max-age=15768000"
        </IfVersion>
        <IfVersion < 2.4.7>
            Header set Strict-Transport-Security "max-age=15768000"
        </IfVersion>
        RequestHeader unset Proxy early
      </IfModule>
    
        SSLUseStapling On
      SSLStaplingResponderTimeout 5
      SSLStaplingReturnResponderErrors Off
    
      <IfModule mod_headers.c>
            RequestHeader unset Proxy early
      </IfModule>
    
      <IfModule mod_php5.c>
        DocumentRoot /var/www/apps
        AddType application/x-httpd-php .php
        <Directory /var/www/apps>
                    Options FollowSymLinks
                    AllowOverride None
                                    Require all granted
                        </Directory>
      </IfModule>
    
      <IfModule mod_php7.c>
        DocumentRoot /var/www/apps
        AddType application/x-httpd-php .php
        <Directory /var/www/apps>
                    Options FollowSymLinks
                    AllowOverride None
                                   Require all granted
                        </Directory>
      </IfModule>
    
      <IfModule mod_php7.c>
        DocumentRoot /var/www/apps
        AddType application/x-httpd-php .php
        <Directory /var/www/apps>
                    Options FollowSymLinks
                    AllowOverride None
                                    Require all granted
                        </Directory>
      </IfModule>
    
      <IfModule mod_fcgid.c>
        DocumentRoot /var/www/apps
        SuexecUserGroup ispapps ispapps
        <Directory /var/www/apps>
                    Options -Indexes +FollowSymLinks +MultiViews +ExecCGI
                    AllowOverride AuthConfig Indexes Limit Options FileInfo
                <FilesMatch "\.php$">
                      SetHandler fcgid-script
                </FilesMatch>
                    FCGIWrapper /var/www/php-fcgi-scripts/apps/.php-fcgi-starter .php
                                    Require all granted
                        </Directory>
        IPCCommTimeout  7200
        MaxRequestLen 15728640
      </IfModule>
    
      <Location /rspamd>
            Order allow,deny
            Allow from all
      </Location>
      RewriteEngine On
      RewriteRule ^/rspamd$ /rspamd/ [R,L]
      RewriteRule ^/rspamd/(.*) http://127.0.0.1:11334/$1 [P]
    
    </VirtualHost>
    
    <IfModule mod_ssl.c>
      SSLStaplingCache shmcb:/var/run/ocsp(128000)
    </IfModule>
    
    
    Any suggestion how i can make sure phpmyadmin use php 8.1 is higly appreciated.
     

    Attached Files:

  2. till

    till Super Moderator Staff Member ISPConfig Developer

  3. sjak_congnac

    sjak_congnac New Member

    Thank you:
    cgi php was already set to 8.1 but i changed it to 7.1 to see its effect.
    I changed also the php to 7.1 and restarted apache but phpmyadmin is still showing 8.3
    I verified it aswell by using an incognito session to exclude i am not watching some cached versions
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    You are using PHPMyAdmin on port 8081 (as you mentioned the apps vhost) and not just /phpmyadmin URL on any website on port 443?
     
  5. sjak_congnac

    sjak_congnac New Member

  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, then there are basically two possibilities: either your system still uses mod_php and mod_php is at PHP 8.3. Or there is still a wrong PHP version referenced somewhere, take a look into the fcgi starter file that is mentioned in the apps vhost, which is
    /var/www/php-fcgi-scripts/apps/.php-fcgi-starter, to see which php binary is used in there and then check which php version that binary has.
     
  7. sjak_congnac

    sjak_congnac New Member

    Code:
    #!/bin/sh
    PHPRC=/etc/php/8.1/cgi/
    export PHPRC
    export PHP_FCGI_MAX_REQUESTS=5000
    export PHP_FCGI_CHILDREN=1
    export PHP_FCGI_MAX_REQUESTLEN=15728640
    exec /usr/bin/php-cgi -d  \
        -d disable_classes= \
        -d disable_functions= \
        -d magic_quotes_gpc=off \
        -d open_basedir=
    
    I am not seeing any reference to a binary ?

    Code:
    /etc/php/8.1/cgi
    total 164
    drwxr-xr-x 3 root root  4096 Jun 15  2024 .
    drwxr-xr-x 6 root root  4096 Jun 15  2024 ..
    drwxr-xr-x 2 root root  4096 Jun 15  2024 conf.d
    -rw-r--r-- 1 root root 73925 Jun 15  2024 php.ini
    -rw-r--r-- 1 root root 73924 Jun 15  2024 php.ini~20240615234442
    
    Weird i would expect a 7.1 reference in this file since i set it
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    /usr/bin/php-cgi
     
  9. sjak_congnac

    sjak_congnac New Member

    I must add something to this thread, in my research i found under additional php versions 2 references with php8.1, but one of em was point to php-fpm8.1 and the other to php8.3 so one of em was mentioned as 8.1 but was under the hood 8.3
     
    Last edited: Feb 8, 2025
  10. sjak_congnac

    sjak_congnac New Member

  11. till

    till Super Moderator Staff Member ISPConfig Developer

    The website php versions / additional PHP versions in ISPConfig do not matter in this case, they do not apply to apps vhost or phpmyadmin. What you should try is this:

    1) Put a phpinfo file in /var/www/apps folder, open it in a browser to see which PHP version shows up there and which PHP mode. This way you know what the apps vhost uses, but that's not necessarily what phpmyadmin uses, as phpmyadmin is a global alias in apache and not bound to apps vhost, depending on the setup.
    2) Now you do the same with phpmyadmin by putting a phpinfo file in its folder, which is probably /usr/share/phpmyadmin
    This will show you which PHP mode phpmyadmin uses.
     
  12. sjak_congnac

    sjak_congnac New Member

    Last edited: Feb 8, 2025
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    The apps vhost URL is .....:8081/ and not ......:8081/apps/
    The phpmyadmin URL looks fine though, maybe phpmyadmin is installed somewhere else then on your servr.
     
  14. sjak_congnac

    sjak_congnac New Member

  15. sjak_congnac

    sjak_congnac New Member

    I am grateful for all the effort that has been put in this problem thus far, is there anything to try after my latest feedback?
     
  16. remkoh

    remkoh Active Member HowtoForge Supporter

    If I'm not mistaking apps and phpmyadmin use system defaults php-fpm version.

    To change that use:
    Code:
    sudo update-alternatives --config php-fpm.sock
     
    till likes this.
  17. sjak_congnac

    sjak_congnac New Member

    Thank you, this was set to 8.4 nonetheless i set it to 8.1 and to make sure it was effected i rebooted the server.
    The config of the php-fpm.sock is after the reboot still at php 8.1, however phpmyadmin is still at php 8.3
     
  18. remkoh

    remkoh Active Member HowtoForge Supporter

    Maybe have a look at
    Code:
    /var/www/php-fcgi-scripts/apps/.php-fcgi-starter
     
  19. sjak_congnac

    sjak_congnac New Member

    Code:
    #!/bin/sh
    PHPRC=/etc/php/8.1/cgi/
    export PHPRC
    export PHP_FCGI_MAX_REQUESTS=5000
    export PHP_FCGI_CHILDREN=1
    export PHP_FCGI_MAX_REQUESTLEN=15728640
    exec /usr/bin/php-cgi -d  \
        -d disable_classes= \
        -d disable_functions= \
        -d magic_quotes_gpc=off \
        -d open_basedir=
    This setting is not effected somehow in phpmyadmin
     
  20. sjak_congnac

    sjak_congnac New Member

    Anyone any new ideas or approaches?
    Thank you in advance
     

Share This Page