Last Updated 2 Aug 2024
|

How To Fix “Your PHP Installation Appears to Be Missing the MYSQL Extension Which Is Required by WordPress” Errors

Quick Summary ↪ This guide shows you how to resolve the "Your PHP installation appears to be missing the MySQL extension which is required by WordPress" error: Update WordPress > Check your PHP version and verify the MySQL extension is installed > Review your php.ini configuration. Read on for more tips.

fix PHP installation error

Have you ever seen the error that says, “Your PHP installation appears to be missing the MySQL extension which is required by WordPress?” We know we have.

Installing WordPress is usually a very easy process. Sometimes, you may be interrupted by frustrating errors. While they are usually easy to address, it’s often difficult to understand exactly what went wrong so that you can fix it.

This is especially true if you aren’t technical and don’t know what PHP, MySQL, or the technologies used by WordPress are.

One such error is related to MySQL, the database technology used by WordPress. This error usually looks like something this:

  • Your PHP Installation Appears to Be Missing the MySQL Extension Which Is Required by WordPress
  • You Are Missing a MySQL Extension
  • PHP Missing SQL Extension
  • WordPress Cannot Connect to Its MySQL Database

In short, it involves a problem between PHP and MySQL and the connection between the two.

What does this error mean? How do you fix it?

In this post, we’ll walk you through solving it in less than five minutes. If you aren’t a technical expert, don’t worry!

Everything is easy to follow and doesn’t require any knowledge of programming. We’ll make it as easy for you as possible.

What Is the “Your PHP Installation Appears to Be Missing the MySQL Extension Which Is Required by WordPress” Error?

missing MySQL extension error example

So what exactly is this error, anyway? Put simply, it just means that your WordPress server is having difficulty connecting to its MySQL database. The exact details can vary, but this is almost always the core issue.

What’s MySQL? MySQL is the database software used by WordPress. It stores virtually all of your data, including user profiles, plugins, post content, post types and more.

You can access your MySQL database via CPanel.

When you get this PHP error, it usually means that there is a problem in the connection between your WordPress website and its database.

Most of the time, the source of this issue is with the PHP on your server. Specifically, that it lacks a certain extension which allows it to connect your site to the MySQL database (hence the name of the error.)

Basically, it means that your WordPress website doesn’t work with the version of PHP currently installed on your server.

Many web hosts preinstall this MySQL extension by default, but others don’t. Linux-based servers, for example, don’t always include it.

If you use a managed hosting service, however, it’s almost guaranteed that they have installed it.

What’s PHP? PHP is just the programming language that WordPress is written in. While it seems complex, PHP is actually quite simple and user-friendly, as far as programming languages go.

You can learn more about PHP or find a course to learn about it and other web development technologies.

What Causes the “Your PHP Installation Appears to Be Missing the MySQL Extension Which Is Required by WordPress” Error?

What causes this error? There are many potential reasons. Let’s cover two of the most likely ones, using an outdated version of PHP or using an outdated version of WordPress.

Using PHP 5.6 or Lower

If you are using an older version of PHP, it might be the source of the problem. There was a change in PHP 5.6 which affects the MySQL extension.

If you are using this version of PHP or older but still have an issue with the MySQL extension it’s likely that the extension is misconfigured or installed incorrectly.

Old Version of WordPress With New Version of PHP

If you have a newer version of PHP installed but are using an older version of WordPress, you might have some issues.

WordPress is updated frequently and it’s important to always stay up to date with new versions. If you don’t, you may be at risk of security issues and general technical problems (like the one this post is about!)

If you use a managed host, it’s likely that they already keep your site up-to-date for you.

A Walkthrough Guide to Fixing the “Your PHP Installation Appears to Be Missing the MySQL Extension Which Is Required by WordPress” Error

Now let’s walk through a number of different ways to solve this issue. We recommend starting at the top and working your way through the post, as there are steps at the beginning which will be useful later.

What You’ll Need

Before we get started, you’ll need the following three things:

  • Website login and password: You’ll need admin access to your site. If you don’t know your username and password, look in your hosting panel.
  • FTP/SFTP or SSH client. To access your site, you’ll need to have a FTP or SSH client. We recommend using FileZilla for FTP/SFTP and PuTTY for SSH.
  • Text editor. You’ll need to modify some basic files. To do that, you need a basic text editor like TextEdit or Sublime Text.

1. Update WordPress

Before anything else, try updating WordPress. As with many technical issues, a simple update can often fix the issue. So, it’s best to try this first!

If you are able to access your WordPress dashboard, updating your site is easy.

Just go to Updates on your WordPress sidebar and see if any updates are available. In extreme circumstances, you could reinstall WordPress, which you can do by clicking the Re-Install Now button.

WordPress updates

If you aren’t able to access your WordPress dashboard, you’ll need to update WordPress manually, via FTP/SFTP or SSH. Here’s how to do that:

First, backup your site. Before making any changes, you should always back it up. Thankfully it’s easy to do this with a backup plugin. Unfortunately, unless you had previously set up the backup plugin, you won’t be able to add it now. That’s just one reason why you should always set up a backup system before you think you’ll need it!

After backing up your site, download the most recent version of WordPress from the official repository. Open up the compressed zip file. (In some cases, it will be opened automatically by your web browser.)

WordPress file structure

Now you’ll see a big list of files. We want to delete three of these items. That’s right, delete.

  • wp-config-sample.php file.
  • wp-config.php file. Sometimes this file won’t be included. If it is included, be sure to delete it.
  • wp-content folder. This is a folder, not a file.

Why do we need to delete these? Because if we don’t delete them and then upload the WordPress package to our website, the content and settings will be reset. We definitely don’t want to do that!

Deleted the files? If you have, it’s on to the next step: uploading them to your server.

filezilla site manager

Once you’ve connected to your site, upload all of the files. Overwrite the ones currently on your server. Once you do this, your site should now be running the latest version of WordPress.

Go back to the front end of your site and see if the issue remains.

2. Check the PHP Version

Still having issues? It’s possible that you have the wrong version of PHP installed. Let’s check to see which version you have.

If you’re using cPanel, you can check the PHP version directly inside the cPanel application.

However, for this tutorial we will connect directly to the server, as it’s a universal way to fix the issue.

First, connect to your site using FTP/SFTP or SSH. In the top level directory (called the “root” directory”) create a new file called phpinfo.php

Inside this file, paste the following code:

<?php
phpinfo();
?>

Now open your internet browser and navigate to website.com/phpinfo.php. (Replace website with your own domain.) Now you’ll see a page that displays the details of your PHP installation.

The exact layout of the page will depend on your host. What you’re looking for is the “PHP Version.” The number next to it is your current version.

In the image below, it’s right at the top of the page. In other installations, it may be in the column, under a section called Core, next to an item called PHP Version.

php version

If the number listed is below 7.0, this is probably the source of the issue. Going forward, you have two options:

  1. Update your PHP version
  2. Check to see if the extra MySQL extension is installed

Keep this PHP version page open, as we might need it in the next step.

How Do I Update the PHP Version?

Much depends on your host and on your particular installation. Read our full guide on how to update your PHP version.

You can also contact your host and ask them to do it for you.

Check to See If the Extra MySQL Extension Is Installed

Don’t want to update PHP? Then you’ll probably need to install the extra MySQL extension.

To see if the extension is already installed, go back to website.com/phpinfo.php, (replacing website with your own domain). There should be a section titled mysql or mysqli. If you can’t find it, use CTRL + F to search for it.

php mysqli

You are looking for an item titled Client API library version.

If this item is there, it means the extension is installed.

If you don’t see it, that means that you don’t have the extension installed.

If you don’t see the item, you should contact your host and ask them to install the extension for you.

Again, it’s generally just a better idea to use a more recent version of PHP. Newer versions are kept up-to-date, include better security fixes, and are generally just safer and more efficient to use.

But what if there is an item titled Client API library version? It means that the extension is already installed.

3. Check If the MySQL Extension Is Configured Properly

If the extension is installed and you’re still having issues, it’s possible that the extension itself is having a problem. There are a few reasons why this may be the case.

  • Incorrect format of php.ini file
  • Incorrect file paths/location of the php.ini file

Incorrect Format of the PHP.ini file

The php.ini file is a configuration file that is run when PHP is first started. It controls things like the memory limit of your website.

An issue might occur when you are using the incorrect version of the php.ini file. Specifically, if you’re using one formatted for Linux servers on a Windows server, or vice versa.

To fix this issue, simply delete the file. It will be recreated when PHP starts running again. But before you delete it, it’s probably best to download a backup copy. That way, you can reupload it in the event of any new issues.

You can find the php.ini file in the /public_html folder of your WordPress site. To delete it, just right click it and select Delete.

delete php ini file

After deleting it, reload your website and see if the error is still displayed.

Incorrect File Paths

This just means that the extension is in the wrong directory. If you think this is the case, contact your host and ask them to sort it out.

Final Thoughts on the MySQL Extension Issue

Fixing an issue with WordPress is usually a pretty easy task. Unfortunately, sometimes it can take trying a few different solutions to arrive at one that will solve the problem.

This is especially true with tougher problems that involve the core technologies of WordPress, PHP and MySQL.

Nonetheless, don’t worry. It is a solvable problem!

Just follow our guide above and you’ll be certain to find a solution to the “Your PHP Installation Appears to Be Missing the MySQL Extension Which Is Required by WordPress” error.

In general, if you keep PHP and WordPress up-to-date, you can avoid many problems like this.

Have you faced this issue before? Which solution worked (or didn’t work) for you? Help out the community and share it below!

Article by
Pratik Chaskar
LinkedInTwitter

Pratik Chaskar holds the pivotal role of CTO at Brainstorm Force, serving as the backbone of the company. Renowned for his organizational skills, strategic thinking, problem-solving attitude, and expertise in leading and executing plans, Pratik plays a crucial role in the BSF’s technological landscape.

Disclosure: This blog may contain affiliate links. If you make a purchase through one of these links, we may receive a small commission. Read disclosure. Rest assured that we only recommend products that we have personally used and believe will add value to our readers. Thanks for your support!

1 comment
  1. coding young Profile Pic

    You have to enter the commands on command line. You need to connect to your server through SSH using an SSH client. Log in with a user that has root privileges.

Leave a Comment

Your email address will not be published. Required fields are marked *

Join 1,653,898+ Happy Site Owners Using Astra

Whether you are a beginner, small business owner, or professional web developer, Astra provides all the tools you need to easily build your beautiful WordPress website.

Download is Just A Click Away!

Membership Retention Checklist Download

REWIND

YEAR IN REVIEW

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form
Scroll to Top