Many business owners utilise WordPress for their company website, as this format is famously reliable and user-friendly. Alas, no software is foolproof, and WordPress is no exception. The error message “Your PHP installation appears to be missing the MySQL extension which is required by WordPress” is omnipresent on this site.
Quite understandably, a continual presence of this error message can grow infuriating. As a result, we have constructed this guide to offer advice on combatting this bane of so many webmaster’s lives.
Get quotes from business growth experts
What causes the “Your PHP installation appears to be missing the MySQL extension which is required by WordPress” error message?
To answer this in detail, we should break down each component of the error message. Please accept our apologies if this is a little basic for some of our more advanced readers. If you understand the terminology involved in this error message, skip ahead of the recommended resolutions. However, new users of WordPress that require a more root-and-branch investigation into this problem should read on.
What is a PHP installation?
PHP is a coding language that is widely embraced on the internet, including WordPress. Other giant names in the online world, such as Facebook and Tumblr, also use PHP.
PHP is popular with notable names like WordPress as it slots effortlessly into HTML, which is equally critical. PHP is also straightforward to use and understand (at least, as much as any coding language!), despite offering many features.
PHP was initially launched in 1995 and has steadily grown in reputation and popularity. As with all software, PHP has seen regular updates too. At present, PHP is on version 8, which was unrolled in late 2020.
PHP is free to use. If you encounter a proposed upgrade that charges for use, do not click and certainly don’t hand over your bank details. The safest way to upgrade or renew your PHP installation is through the official website of the language.
What is a MySQL extension?
MySQL is free software that helps an internet site manage information in a database. SQL stands for Structured Query Language – the My is named after the creator’s daughter.
The purpose of MySQL is to filter and manage any data found in a website, making it simple for a webmaster to make changes to content and layout. In essence, MySQL works as follows:
- A webmaster connects to an internet server
- The user issues a command
- MySQL interprets this command
- The command is actioned
MySQL has been used by the general public since 1998 and is currently operating on version 8. This upgrade was released in 2018. MySQL is popular as even the free version is highly flexible and tends not to struggle with large swathes of data. MySQL is also celebrated for keeping data safe and secure.
Unfortunately, not all programming languages support MySQL, leading to the dreaded error message that brought you to this page. We’ll discuss that in more detail shortly, though, when discussing resolutions.
Why does WordPress need PHP and MySQL?
WordPress loves PHP as it likes to work in conjunction with HTML. Think of PHP as the middleman between WordPress and HTML – the coding language tags assigned to PHP ensure that your WordPress site works as it should.
This is important as it will save you a great deal of time when creating a website. PHP provides a range of templates that are converted into HTML via tags. Without this, you’d need to work on every single page of a website singularly.
How does MySQL fit into this? Well, as we discussed previously, MySQL sorts and maintains data. Picture MySQL as the cyber filing cabinet PHP rifles through, finding what it needs to issue commands. Most versions of WordPress will have MySQL installed as a standard plugin as it is so indispensable.
So, what causes the error message?
Reading the above, you’d be forgiven for wondering why you’re seeing a “Your PHP installation appears to be missing the MySQL extension which is required by WordPress” error message.
You have a WordPress website. PHP and MySQL are typically pre-installed onto any computer and are co-dependent. Where does the issue lie?
Most of the time, you can lay blame at the feet of PHP. Version 7.0 – which was first released in 2015 – and beyond no longer automatically support MySQL. This poses a problem for WordPress, as it relies heavily upon both.
Armed with this knowledge, your error message makes a lot more sense. Reread it – “Your PHP installation appears to be missing the MySQL extension which is required by WordPress.” When you know what PHP and MySQL are, the error message looks less like technical jargon and more like a problem that needs to be solved.
4 ways to fix the “Your PHP installation appears to be missing the MySQL extension which is required by WordPress” error message
We promised to explain how to rectify this issue, so please see below for four possible fixes for this concern. We promise that the words “turn it off and on again” will not feature anywhere!
On paper, you could take the simple fix of ‘downgrading’ your PHP installation while using WordPress. If you use a version that predates 7.0, there will be no issues with compatibility surrounding MySQL. This approach can cause problems elsewhere online, though, and version 5.6 or below is incompatible with WordPress in 2021.
We advise that you try each of these fixes in turn, aiming to eradicate the problem for good. Naturally, though, WordPress will always be temperamental. We cannot promise that any of these are permanent fixes. Do give our solutions a shot, though. Do not just uninstall everything and start over – that’s creating more work than necessary.
How to fix “Your PHP installation appears to be missing the MySQL extension which is required by WordPress”
- Upgrade your WordPress installation
If your WordPress is out of date, it may be struggling to keep up with the expectations placed upon it by PHP and MySQL.
- Check that MySQL installed
The heart of this error message claims that the MySQL extension is missing, so you should ensure that you have a MySQL extension.
- Review your PHP configuration
If you’re still not enjoying any success, you’ll need to look deeper into your PHP configuration.
- Ensure your PHP and MySQL are connected
The most technical fix that your WordPress error may require is reintroducing your PHP and MySQL.
1. Upgrade your WordPress installation
You will obviously be hoping for a quick fix to this solution. The fastest of all would doubtless be to check which version of WordPress you are running. If your WordPress is out of date, it may be struggling to keep up with the expectations placed upon it by PHP and MySQL.
First thing’s first to check this – sign into WordPress and head to your dashboard. Once in, review the left-hand border of the site. If you see any request for updates under the home page, you are running an outdated version. Equally, the main body of the site may inform you that you’re running an outdated version. Follow the on-screen prompts to ensure that all programs are at the cutting edge.
Ensure you have backed up any drafts before doing this, and ensure you have a Plan B if things go wrong. A WordPress update should be highly straightforward but always step in if it looks like your website will endure downtime for a significant time. This may end up costing you money.
Once you have completed this update to your WordPress, attempt to rerun your function. In an ideal world, you will not see the error message again. You found the easiest possible fix – to avoid it happening again in future, consider setting WordPress to update automatically. If not, you’ll need to start peering a little deeper under the bonnet of your website.
2. Check that MySQL installed
The heart of this error message claims that the MySQL extension is missing, so you should ensure that you have a MySQL extension. While this is usually installed by default to any computer and OS, accidents can happen. You have inadvertently agreed to remove MySQL when installing other software.
Head to the WordPress root folder through FTP. Create an phpinfo.php file and save this. Now, view this in your browser and review your PHP details. For example, if we were to do this, we would enter www.creative.onl/info.php. This will lead you to a page that explains how your PHP looks in a table.
The most important lines will refer to MySQL, which should be detailed beside Client API library version. Take a look at this example of what you can expect to find.
Now, based on this example, the operator of this computer does have MySQL installed – namely version 5.0. In this instance, this means that the presence of MySQL is not a problem. The issue either lies with your PHP installation or the fact that PHP and MySQL are not communicating. Skip to steps 3 and 4 to resolve these concerns.
If the Client API line of the table is blank, this means that MySQL is not installed. This needs to be rectified before you do anything else. Do not just google MySQL and look for the first promise of a fix. Focus on installing through the appropriate channels, following the relevant instructions for your particular operating system.
3. Review your PHP configuration
If you’re still not enjoying any success, you’ll need to look deeper into your PHP configuration. You’re getting into the weeds now, so make sure everything on your WordPress site is backed up. You need to have a disaster recovery protocol in place, just in case.
Repeat the process described above, gaining access to your info.php folder. At this point, scroll down past the MySQL sections and take a look at the settings. Here you’ll find information on the PHP version that you’re running.
As discussed previously, if you’re running a version beginning with 7.0.0 or above, this could be the problem. A WordPress update should have resolved that, though. If that is not the case, you’ll need to skip to step 4. The chances are you’re going to need to realign the communication between PHP and MySQL manually.
4. Ensure your PHP and MySQL are connected
The most technical fix that your WordPress error may require is reintroducing your PHP and MySQL. As the error message suggests, WordPress is using PHP and struggling to find a MySQL connection. There is no shortcut around this. If the updates that we previously suggested have not yielded results, you need to rectify this.
Once again, you need to head back to your phpinfo.php page. Go back to your Core settings and feast your eyes on the list of details made available to you. What you’re looking for here are two lines in the table – Configuration File Path and Loaded Configuration File. Here’s an example of how this could look, though your mileage may vary depending on your OS.
These two addresses should match. Make a note of them. Now, scroll down and look for another line in the table labelled extension_dir. This should host an address that matches those found in the Configuration File Path and Loaded Configuration File lines.
If this is not the case, you have found your problem. The error message is giving it to you straight – your PHP installation is struggling to find the MySQL extension. You’ll need to manually edit your php.ini file to course correct. Tread carefully, and don’t do more damage than good. If you are not wholly confident doing this, enlist help.
We hope this guide has assisted in negotiating the occasionally troublesome world of WordPress. This format is typically helpful, but as always, error messages will arise. If you do not understand how to fix these problems, they can grow very frustrating.
If you lose patience with the world of web design and prefer to enlist an agency, Creative.onl are always happy to hear from you. Otherwise, we wish you the best of luck in creating your WordPress site – be sure to follow our articles for additional insights.