PhpMyAdmin after php upgrade shows Internal Server Error

Hello. The Phpmyadmin shows 500 Error: Internal server error after upgrade of PHP.
System PHP Version was upgraded from 8.0 to 8.2
Enabled PHP Versions were changed from 8.0 to 8.2
I also tried restarting: apache, nginx, php8.0-fpm.service, php8.2-fpm.service but the problem still appears.

Hi @oopss,

Show the output of these commands:

php -v
lsof -Pn +c0 -i:9000 -sTCP:LISTEN
find /etc/php/ -name "www.conf"
ls -l /etc/phpmyadmin/

Hello. Here are the outputs:

php -v
PHP 8.2.16 (cli) (built: Feb 16 2024 15:53:11) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.16, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.16, Copyright (c), by Zend Technologies
lsof -Pn +c0 -i:9000 -sTCP:LISTEN
COMMAND       PID USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME
php-fpm8.2 200176 root   12u  IPv4 XXXXXXXXX      0t0  TCP 127.0.0.1:9000 (LISTEN)
find /etc/php/ -name "www.conf"
/etc/php/8.2/fpm/pool.d/www.conf
ls -l /etc/phpmyadmin/
total 8
drwxr-x--- 2 root www-data 4096 Jun  16  2022 conf.d
-rw-r----- 1 root www-data 1003 Jun  16  2022 config.inc.php

Those outputs look fine.

Are you using Nginx standalone or Nginx+Apache?

If you are using Nginx+Apache, show the output of these commands:

ls -l /etc/apache2/conf.d/
dpkg -l | grep libapache2-mod-php
apache2ctl -M

Here are the outputs:

ls -l /etc/apache2/conf.d/
total 16
-rw-r--r-- 1 root root  534 Jun  16  2022 XXX.XXX.XXX.XX.conf
drwxr-xr-x 2 root root 4096 Mar  3 12:08 domains
-rw-r--r-- 1 root root  130 Jun  16  2022 hestia-event.conf
-rw-r--r-- 1 root root 1427 Jun  16  2022 phpmyadmin.inc
dpkg -l | grep libapache2-mod-php
ii  libapache2-mod-php8.2              8.2.16-1+0~20240216.40+debian11~1.gbp6cbea3        amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  libapache2-mod-php8.3              8.3.3-1+0~20240216.17+debian11~1.gbp87e37b         amd64        server-side, HTML-embedded scripting language (Apache 2 module)
apache2ctl -M
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using XXXXXXXXXXXX.com. Set the 'ServerName' directive globally to suppress this message
Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 actions_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 fcgid_module (shared)
 filter_module (shared)
 status_module (shared)
 mime_module (shared)
 mpm_prefork_module (shared)
 negotiation_module (shared)
 php_module (shared)
 proxy_module (shared)
 proxy_fcgi_module (shared)
 remoteip_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 socache_shmcb_module (shared)
 ssl_module (shared)
 suexec_module (shared)

I’m leaving now so I can’t answer, sorry. But the problems seems you are using mpm_prefork instead of mpm_event, also, you should uninstall those libapache2 php modules.

I’ll be back in a few hoours and could share the details or you can search the forum by sahsanu and mpm_event and you will find how to do it. Remember to remove the libapache mods.

Steps that I have tried:

  • Downgraded the system version of PHP to 8.0 and the phpMyAdmin is working again.

  • Upgraded the system version of PHP to 8.2, the phpMyAdmin is working correctly.

  • The error appears again only after uninstall of the PHP 8.0
    Also the phpMyAdmin now shows that the PHP version is 8.0.30, however in Hestia CP admin the System PHP Version is 8.2

Hestia doesn’t use mpm_prefork anymore, it uses mpm_event and also, doesn’t use php module.

What I would do:

Remove php apache libraries (if you have libapache2-mod-php8.0 remove it too):

apt remove libapache2-mod-php8.2 libapache2-mod-php8.3

Remove php 8.0 and install 8.2:

v-delete-web-php 8.0
v-add-web-php 8.2

Disable php and mpm_prefork modules. Enable mpm_event and restart apache2:

a2dismod php
a2dismod mpm_prefork
a2enmod mpm_event
systemctl restart apache2

If doesn’t work, check that your /etc/apache2/apache2.conf file looks like this:

# It is split into several files forming the configuration hierarchy outlined
# below, all located in the /etc/apache2/ directory:
#
#       /etc/apache2/
#       |-- apache2.conf
#       |       `--  ports.conf
#       |-- mods-enabled
#       |       |-- *.load
#       |       `-- *.conf
#       |-- conf.d
#       |       `-- *

# Global configuration
PidFile ${APACHE_PID_FILE}
Timeout 30
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 10

<IfModule mpm_prefork_module>
    StartServers          8
    MinSpareServers       5
    MaxSpareServers      20
    ServerLimit         256
    MaxClients          200
    MaxRequestsPerChild 4000
</IfModule>

<IfModule mpm_worker_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          200
    MaxRequestsPerChild 4000
</IfModule>

<IfModule mpm_event_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          200
    MaxRequestsPerChild 4000
</IfModule>

# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
#User www-data
#Group www-data

AccessFileName .htaccess

<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy all
</Files>

DefaultType None
HostnameLookups Off

ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn

# Include module configuration:
Include mods-enabled/*.load
Include mods-enabled/*.conf

# Include list of ports to listen on and which to use for name based vhosts
Include ports.conf

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%a %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
LogFormat "%b" bytes

IncludeOptional conf.d/*.conf
IncludeOptional conf.d/domains/webmail.*.conf
IncludeOptional conf.d/domains/*.conf

# Include the virtual host configurations:
#Include sites-enabled/

ErrorDocument 403 /error/403.html
ErrorDocument 404 /error/404.html
ErrorDocument 500 /error/50x.html
ErrorDocument 501 /error/50x.html
ErrorDocument 502 /error/50x.html
ErrorDocument 503 /error/50x.html
ErrorDocument 506 /error/50x.html
2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.