Note: This post assumes that you are using WHM and EasyApache 4. If you aren’t using them but are seeing the same problem, then the heart of the solution is correct (you will need to install the proper MySQL extension, but the implementation is different).
It was around 2:00 AM last Saturday when were scheduled to update PHP on the server powering a major website that we manage to the latest version, which is PHP 7.2. We expected a smooth update, but, unfortunately, after updating to PHP 7.2 (we used EasyApache 4), we saw the following error:
Error displaying the error page: 0 – The MySQL adapter mysqli is not available
Hmmm… It seems that our update to PHP 7.2 did not include the appropriate MySQL libraries; we needed to install them. So, we did the following:
- We logged in to WHM.
-
We clicked on the EasyApache 4 link in the left panel (just under Software).
-
We clicked on the Customize button next to Currently Installed Packages.
-
We clicked on the PHP Extensions link in the left middle tab.
-
We enabled the php72-php-mysqlnd extension.
-
We clicked on Next at the bottom several times and finally we clicked on Provision.
-
We restarted Apache.
We then visited the website, and, unsurprisingly, this time it worked! We were very happy because the whole thing consisted of a few minutes of downtime during off-hours.
But why wasn’t the MySQL extension “checked” by default in EasyApache 4?
We don’t know. We know that, in the absolute majority of cases, PHP is used in conjunction with MySQL, so the fact that EasyApache 4 is not selecting the php72-php-mysqlnd extension by default is a bit disappointing.
Will doing the above always fix the “0 – The MySQL adapter mysqli is not available” error?
It should, but, if it doesn’t fix the problem for you, then make sure that:
- You restarted Apache. If you don’t restart Apache, then your changes to the PHP instance will not take effect and your problem won’t be solved.
-
You are really using PHP 7.2. Installing PHP 7.2 (or any version of PHP) through EasyApache 4 (or EasyApache 3) doesn’t necessarily mean that you are actually using PHP 7.2 on your Joomla site. In order to force PHP 7.2 on all your cPanel accounts, then you will need to login to WHM, click on MultiPHP Manager on the left tab (under Software), and then, under System PHP Version, choose ea-php72 and then click on Apply. You will need to restart Apache after doing this.
Alternatively, you can set the PHP version to 7.2 at the application level, by opening the .htaccess file and adding the following line to its very beginning:
<IfModule mime_module> AddType application/x-httpd-ea-php72 .php .php5 .phtml </IfModule>
The above line will instruct Apache to use your chosen PHP version instead of the global PHP version that is set in the MultiPHP Manager.
We hope that this post helped you resolve the “0 – The MySQL adapter mysqli is not available” error on your Joomla website. If it didn’t, or if you feel that fixing the problem is a bit over your head, then please contact us. Our fees are super affordable, our work is extremely clean, and we are really friendly!