Published on: August 9, 2015 by Maddy Mattocks
We came across the following error message on all sites, hosted on a server configured with cPanel, CloudLinux PHP Selector (CL Selector) and Percona as DBMS. Issue was happening on only one server and not on others though.
Your PHP installation appears to be missing the MySQL extension which is required by WordPress
Some sites showed the error message of inability to load “pdo_mysql” and further investigations revealed that other two extensions mysqli and mysql also failed to load when checked through a simple phpinfo script. To our surprise all those modules were enabled in the check box available in the “PHP Version Selector” in cPanel. But those modules were not shown as loaded in the phpinfo page for all php versions.
We tried running cagefsctl –rebuild-alt-php-ini, but that didn’t help.
We checked the php extension directory shown in the phpinfo page and for the version it was /opt/alt/php53/usr/lib64/php/modules
Below is the output of directory listing for these extensions
lrwxrwxrwx 1 root root 40 Nov 5 00:19 mysqli.so -> /opt/alt/php53/etc/percona5.5/mysqli.so lrwxrwxrwx 1 root root 39 Nov 5 00:19 mysql.so -> /opt/alt/php53/etc/percona5.5/mysql.so lrwxrwxrwx 1 root root 43 Nov 5 00:19 pdo_mysql.so -> /opt/alt/php53/etc/percona5.5/pdo_mysql.so
Since the issue spurted quite recently and file modification was quite recent ie Nov 5 ( Today too is Nov 5 ;-)) , we checked for possibilities of any recent updates which could have led for such an issue
Yum update log showed the following entries:
Nov 05 00:19:51 Updated: alt-php53-mysql-meta-1-14.el6.x86_64 Nov 05 00:19:52 Updated: 1:alt-php54-pear-1.9.5-1.el6.noarch Nov 05 00:19:52 Updated: alt-php55-mysql-meta-1-12.el6.x86_64 Nov 05 00:19:52 Updated: alt-php52-mysql-meta-1-15.el6.x86_64 Nov 05 00:19:52 binutils-22.214.171.124.2-5.42.el6.x86_64: 100 Nov 05 00:19:53 Updated: 1:alt-php55-pear-1.9.5-1.el6.noarch Nov 05 00:19:53 Updated: 1:alt-php53-pear-1.9.5-1.el6.noarch
Hence we concluded that the recent update broke the CloudLinux php and it needs to be addressed.
Another server with the same configuration without the update showed the links as given below
rwxrwxrwx 1 root root 41 Jul 11 05:21 pdo_mysql.so -> /opt/alt/php53/etc/mysql5.5/pdo_mysql.so
If you check the paths, you can see that the modified version shows /opt/alt/php53/etc/percona5.5/mysql.so , while the non updated version shows /opt/alt/php53//etc/mysql5.5/pdo_mysql.so
Hence we presume that the new update created the link to the percona folder, which CloudLinux failed to load .
As simple work around we did the following fix. A perfect solution would be to update the Percona.
cd /opt/alt/php55/usr/lib64/php/modules rm -f mysqli.so mysql.so pdo_mysql.so
cross checked the existence of directories in the destination path
root@server [/opt/alt/php53/etc]# ls ./ mariadb10/ mysql5.5/ pear.conf php.d@ rpm/ ../ mysql5.0/ mysql5.6/ percona5.5/ php.d.all/ cron.daily/ mysql5.1/ pear/ percona5.6/ php.ini
Recreated the links to the corresponding folders
[/opt/alt/php55/usr/lib64/php/modules]# ln -s /opt/alt/php53/etc/mysql5.5/pdo_mysql.so pdo_mysql.so [/opt/alt/php55/usr/lib64/php/modules]# ln -s /opt/alt/php53/etc/mysql5.5/mysqli.so mysqli.so [/opt/alt/php55/usr/lib64/php/modules]# ln -s /opt/alt/php53/etc/mysql5.5/mysql.so mysql.so
It fixed the issue 🙂 Try to use the cloudLinux PHPselector
PS: Re-added the posts after a few 404s from Google and other search engines.
Category : cPanel, Linux, MySQL