Your PHP Installation Appears to be Missing the MySQL Extension

You’re facing the error “Your PHP installation appears to be missing the MySQL extension which is required by WordPress“. Most solutions will tell you to check PHP version, extension, .htaccess or installing and configuring MySQL module.

While they might be helpful, you don’t always need to start with checking them as said. For me, it was a simple yet careful solution to fix the missing MySQL extension error. So in this article, I’m telling you was what causing the issue and what I did on my Apache PHP server.

Missing MySQL Extension PHP WordPress

Causing PHP Installation Missing MySQL Extension in WordPress

We were hosting multiple WordPress websites on our Linux hosting account. We use Hostinger servers to host PHP websites. If you would like to know why we use Hostinger and comprehensive review then read the article here.

So all of our WordPress sites were loading fine except one. It made me quickly realize that the problem isn’t with PHP or MySQL extension installed on the server. Also, we knew that we had the PHP version above 7.0.

If you don’t know which PHP version your troubling domain is using then no worry. Here is a similar excellent article to identify website-specific PHP information using phpinfo() function. We were using an older WordPress version with higher PHP installation and it was causing the trouble.

PHP 7.0 and beyond no longer support mysql extension. Rather they use mysqli or PDO_MySQL extensions to connect databases. However, the outdated WordPress installation was seeking for the mysql module. This incompatibility was ultimately causing PHP installation appears to be missing the MySQL extension.

Fixing Missing MySQL Extension Error

So we had two options. Either change the PHP version to 5.6/lower or update WordPress to the latest. We had opted the later. Changing PHP to 5.6 or lower is no more a wise idea and it leads to poor performance as well as security concerns.

However, in some cases, you might want to lower the PHP version. Luckily, rather downgrading global PHP version, you can specify domain-wise PHP handler. I will sooner write an article explaining how to do it easily.

Updating WordPress to Match with PHP Installation.

So we had to update the outdated WordPress to make it compatible with PHP installation. But there was another problem. You can easily update WordPress from the admin but we hadn’t access to it. As opening the site in the browser, was ending us with the “Your PHP Installation Appears to be Missing the MySQL Extension” message.

Thus the only option left to use was to update via FTP. So first of all, we took a backup of the site including the database. Then we downloaded the latest WordPress version from the official website and unzipped it. Further, we connected to our hosting server via FTP. 

There we updated wp-admin and wp-includes folder, from the local to remote. The FTP program asked us to confirm the replacement of outdated files with the fresh one. It also copied files that were present in the latest version but not in the old installation.

We’ve updated files residing at the same level to the wp-includes and wp-admin directories, except the wp-config.php and .htaceess. Also, we left the wp-content directory untouched since all these contain custom information.

MySQL Extension Error is Gone Away

After doing all the careful updates as expressed earlier, we tried to log in to WP dashboard. And we had the access now. Awesome! We still had a few other errors. But updating plugins from WP Admin fixed them too. Also, update the theme if you have a newer one.

Finally, we ran the site and checked for any error we could get. However, all was smooth. The last thing we did was examining the error log for a few days. WordPress offers a nice way to log errors and debug the website.

So updating older WordPress version to the latest one fixed the missing MySQL Extension in PHP installation. It was appearing as a PHP incompatibility issue. So we hadn’t any need to mess with core software installed in our hosting account. Except checking the domain-specific PHP version.

However, in rare cases, you might require to check packages and install MySQL extension. Or fixing misconfigured extension directory. Also, it’s a good idea to check the .htaccess file for any troubling customization.

You Might Interested In

Leave a Reply