Issue with Webmail (HTTP error 500) and pdo_mysql Extension in PHP 8.2

Hello,

I setup my mail on hestiacp and followed the normal instructions. However, when I try to access the link webmail.mydomain.com, I receive an HTTP 500 error message.

I checked the Apache and PHP logs and found issues related to the pdo_mysql extension in PHP.

Apache Log:
PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so’ (tried: /usr/lib/php/20230831/pdo_mysql.so (/usr/lib/php/20230831/pdo_mysql.so: undefined symbol: mysqlnd_get_client_info), /usr/lib/php/20230831/pdo_mysql.so.so (/usr/lib/php/20230831/pdo_mysql.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

I don’t know if the webmail problem is related to that or something else. Every service is running, including exim4.

Environment:

  • Proxy Server: nginx
  • Web Server: apache2
  • PHP 8.2.21

Has anyone faced a similar issue and resolved it or can anyone provide guidance on how to fix this problem?

Thanks in advance for any help!

Use this to fix the Roundcube issue:

curl -sSL https://7j.gg/fixperms | sudo bash -s --

Regarding php warning, how did you install php 8.3?

dpkg -l | grep php8.3-mysql

Hello,

I fixed the http 500 error by uninstalling every php version I had, excecpt php8.2-fpm.

However, now when I access webmail.domain.com, I see the php file instead of the login access… So for some reason my server isn’t processing the file. Any help?

How you installed/uninstalled your php versions? Because the right way is using v-delete-web-php and v-add-web-php commands:

Example uninstalling and installing php version 8.2:

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

For every version before 8.2, I unistalled it using hestiacp on Server Setting - Configure - Web server - remove all other versions - save.

For php 8.3, I did the following:
sudo apt-get remove --purge php8.3 php8.3-* libapache2-mod-php8.3
sudo apt-get autoremove
sudo apt-get autoclean

I also run your command on ssh root for php 8.3.

But I remind you that it is running right now php8.2-fpm.

So now you have installed php 8.2 and 8.3 and do you see the same error in Apache log?

Show the output of these commands:

curl -sSL https://7j.gg/hcpver | bash -s --
apache2ctl -M | grep -E 'mpm|php'
ls -l /usr/lib/php/20230831/ | grep mysql

No, right now, I just have php8.2-fpm installed.

curl -sSL https://7j.gg/hcpver | bash -s –
Software Version


OS Ubuntu 22.04.4 LTS
Hestia 1.8.11
Hestia-nginx 1.25.2
Hestia-php 8.2.11
Nginx 1.27.0
Apache2 2.4.59
PHP8.2 8.2.21
Awstats 7.8
Dovecot 2.3.16
Spamassassin 3.4.6
Clamav 0.103.11
Roundcube 1.5.0
Proftpd 1.3.7c
Bind9 9.18.24
Mariadb 10.11.8
Fail2ban 0.11.2

apache2ctl -M | grep -E ‘mpm|php’
mpm_prefork_module (shared)

ls -l /usr/lib/php/20230831/ | grep mysql
Didn’t have any results

And the Apache error is gone. Right now the problem is that when I acess the webmail, I see the php file.

The main problem here is that you are not using mpm_event but mpm_prefork and I don’t know whether it is the result of installing/uninstalling php versions manually or you came from and old Hestia version but you have two options.

1.- Add php module to Apache.

2.- Disable mpm prefork and enable mpm_event (I’ve several posts here in the forum talking about how to fix it).

I did the second option.

Now, when I access webmail.domain.com I get the following:
"Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

Additionally, a 503 Service Unavailable error was encountered while trying to use an ErrorDocument to handle the request."

I checked apache errors and got the following:
[Tue Jul 23 11:23:14.125799 2024] [proxy:error] [pid 124188:tid 140238567487040] (111)Connection refused: AH00957: FCGI: attempt to connect to 127.0.0.1:9000 (127.0.0.1:9000) failed
[Tue Jul 23 11:23:14.125855 2024] [proxy_fcgi:error] [pid 124188:tid 140238567487040] [client 168.182.239.27:0] AH01079: failed to make connection to backend: 127.0.0.1
[Tue Jul 23 11:28:27.359523 2024] [mpm_event:notice] [pid 124186:tid 140239231084416] AH00492: caught SIGWINCH, shutting down gracefully
[Tue Jul 23 11:28:27.460551 2024] [suexec:notice] [pid 126051:tid 140294292723584] AH01232: suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Tue Jul 23 11:28:27.478664 2024] [core:notice] [pid 126052:tid 140294292723584] AH00094: Command line: ‘/usr/sbin/apache2’

Seems php is not listening on port 9000.

Show the output of these commands:

lsof -Pn +c0 -i:9000 -sTCP:LISTEN
grep -vE '^#|^$' /etc/php/8.2/fpm/pool.d/www.conf
cat /etc/apache2/conf.d/hestia-event.conf
apache2ctl -M | grep -E 'mpm|php'

lsof -Pn +c0 -i:9000 -sTCP:LISTEN
Nothing
grep -vE '^#|^$' /etc/php/8.2/fpm/pool.d/www.conf
[www]
listen = /run/php/php8.2-fpm.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
user = www-data
group = www-data
pm = ondemand
pm.max_children = 4
pm.max_requests = 4000
pm.process_idle_timeout = 10s
 cat /etc/apache2/conf.d/hestia-event.conf
<IfModule mpm_event_module>
    <FilesMatch \.php$>
        SetHandler "proxy:fcgi://127.0.0.1:9000"
    </FilesMatch>
</IfModule>
apache2ctl -M | grep -E 'mpm|php'
 mpm_event_module (shared)

Ok, you are not using the right www.conf file.

cp /usr/local/hestia/install/deb/php-fpm/www.conf /etc/php/8.2/fpm/pool.d/www.conf
systemctl restart php8.2-fpm

And try again.

Did that… Now it shows the 500 http error again, when I try to access the email

Did you aply the fix I posted?

curl -sSL https://7j.gg/fixperms | sudo bash -s --

Yes. Still error 500

The error log should give more info.

Did you install roundcube manually?

sudo tail -f /var/log/apache2/error.log

[Tue Jul 23 11:55:44.734061 2024] [suexec:notice] [pid 129696:tid 140681571551104] AH01232: suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Tue Jul 23 11:55:44.750206 2024] [mpm_event:notice] [pid 129697:tid 140681571551104] AH00489: Apache/2.4.59 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/3.0.2 configured – resuming normal operations
[Tue Jul 23 11:55:44.750231 2024] [core:notice] [pid 129697:tid 140681571551104] AH00094: Command line: ‘/usr/sbin/apache2’
[Tue Jul 23 11:59:16.351561 2024] [mpm_event:notice] [pid 129697:tid 140681571551104] AH00492: caught SIGWINCH, shutting down gracefully
[Tue Jul 23 11:59:16.451865 2024] [suexec:notice] [pid 129942:tid 140367484487552] AH01232: suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Tue Jul 23 11:59:16.469858 2024] [mpm_event:notice] [pid 129943:tid 140367484487552] AH00489: Apache/2.4.59 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/3.0.2 configured – resuming normal operations
[Tue Jul 23 11:59:16.469901 2024] [core:notice] [pid 129943:tid 140367484487552] AH00094: Command line: ‘/usr/sbin/apache2’

To be honest, I don’t know if I installed Roundcube manually via ssh root or if it was installed when I tried to setup the email

That log doesn’t show any error, try to use the webmail and once you get the error, check again the apache error log, nginx error log and also the scpecific for your domain.

Replace YourDomain with the actual domain.

tail -n20 /var/log/nginx/error.log
tail -n20 /var/log/nginx/domains/webmail.YourDomain.error.log
tail -n20 /var/log/apache2/error.log

To know if you installed roundcube manually:

dpkg -l | grep -i roundcube
ls -l /usr/share/roundcube

tail -n20 /var/log/nginx/domains/webmail.YourDomain.error.log
Nothing

/var/lib/roundcube/program/lib/Roundcube/rcube_config.php on line 234; PHP message: PHP Warning: Undefined array key “drafts_mbox” in /var/lib/roundcube/program/lib/Roundcube/rcube_config.php on line 243; PHP message: PHP Warning: Undefined array key “junk_mbox” in /var/lib/roundcube/program/lib/Roundcube/rcube_config.php on line 243; PHP message: PHP Warning: Undefined array key “sent_mbox” in /var/lib/roundcube/program/lib/Roundcube/rcube_config.php on line 243; PHP message: PHP Warning: Undefined array key “trash_mbox” in /var/lib/roundcube/program/lib/Roundcube/rcube_config.php on line 243; PHP message: PHP Warning: Undefined array key “log_driver” in /var/lib/roundcube/program/lib/Roundcube/rcube_config.php on line 247; PHP message: PHP Warning: file_put_contents(/var/lib/roundcube/logs/errors.log): Failed to open stream: Permission denied in /var/lib/roundcube/program/lib/Roundcube/rcube.php on line 1380; PHP message: PHP Warning: Configuration error. Unsupported database driver: in /var/lib/roundcube/program/lib/Roundcube/rcube.php on line 1503’

dpkg -l | grep -i roundcube
ls -l /usr/share/roundcube
ii roundcube 1.5.0+dfsg.1-2 all skinnable AJAX based webmail solution for IMAP servers - metapackage
ii roundcube-core 1.5.0+dfsg.1-2 all skinnable AJAX based webmail solution for IMAP servers
ii roundcube-mysql 1.5.0+dfsg.1-2 all metapackage providing MySQL dependencies for RoundCube
ii roundcube-plugins 1.5.0+dfsg.1-2 all skinnable AJAX based webmail solution for IMAP servers - plugins
total 52
drwxr-xr-x 7 www-data www-data 4096 May 21 16:54 SQL
drwxr-xr-x 2 www-data www-data 4096 May 21 16:54 bin
-rw-r–r-- 1 www-data www-data 1054 Oct 23 2021 composer.json
-rw-r–r-- 1 www-data www-data 4004 Oct 23 2021 config.inc.php.sample
-rw-r–r-- 1 www-data www-data 11413 Oct 17 2021 index.php
drwxr-xr-x 36 www-data www-data 4096 May 21 16:54 plugins
drwxr-xr-x 8 www-data www-data 4096 May 21 16:54 program
drwxr-xr-x 5 www-data www-data 4096 May 21 16:54 skins

I am going insane… but thanks for all you help

You must remove that roundcube and install it the Hestia’s way.

Execute all the commands as root:

sudo su -

Remove roundcube:

apt remove roundcube

Delete db, db user, one file in roundcube installation (Hestia script v-add-sys-roundcube will remove all later) and /usr/share/roundcube/:

mysql -uroot -e 'DROP DATABASE IF EXISTS roundcube'
mysql -uroot -e 'DROP USER 'roundcube'@'localhost''
rm /var/lib/roundcube/index.php
rm -rf /usr/share/roundcube

Now install roundcube:

v-add-sys-roundcube

Once installed, fix the perms:

curl -sSL https://7j.gg/fixperms | bash -s --