How to Fix Missing PHP MySQL Extension in WordPress


Even though WordPress is a stable platform, errors like Your PHP installation appears to be missing the MySQL extension which is required by WordPress are not uncommon.

This error typically occurs when the necessary MySQL extensions are not installed or enabled in your PHP environment.

Learn how to resolve the PHP error related to the missing MySQL extensions in WordPress.

Fixing the missing MySQL extension error in WordPress.


  • Access to the WordPress Dashboard.
  • Access to the server hosting the WordPress installation (local, cPanel, or SSH).
  • A user account with sudo privileges.
  • Access to a command line/terminal window.

What Causes the PHP Missing MySQL Extension Error in WordPress?

When WordPress cannot interact with the website's database due to missing MySQL extensions for PHP, it displays the Your PHP installation appears to be missing the MySQL extension which is required by WordPress error.

The most common causes include:

  • Outdated WordPress. Newer PHP versions (starting from 7.0) have deprecated the original mysql extension in favor of mysqli or PDO_MySQL. An older WordPress version might not be fully compatible with the current PHP environment.
  • Outdated PHP. Modern WordPress installations work best with the mysqli or PDO_MySQL extensions, which are compatible with PHP version 7.4 or later. Using an outdated PHP version can lead to compatibility issues.
  • Missing or Disabled MySQL Extensions. If both WordPress and PHP are up to date, the required mysqli or PDO_MySQL extensions may be missing or disabled in the PHP configuration.
  • Incorrect PHP Configuration. Incorrect settings in the php.ini file, such as wrong file paths, improper extension directories, or commented-out extensions, can trigger this WordPress error.

How to Fix PHP Missing MySQL Extension Error in WordPress

To fix the Your PHP installation appears to be missing the MySQL extension error, ensure the WordPress and PHP versions are compatible, check if the required MySQL extensions are installed and active, and modify the php.ini file to correct potential misconfigurations.

Depending on the level of access, you can troubleshoot this issue through the WordPress dashboard, by accessing server files directly via SFTP, or by using a command-line interface via SSH.

Update WordPress Core Software

Outdated WordPress versions can cause the Your PHP installation appears to be missing the MySQL extension error. To update the core software in the WordPress admin:

1. Select Dashboard and then Updates.

2. The system displays an update option if a newer WordPress version is available. Select Update Now to install the latest WordPress version.

Update WordPress from Dashboard.

Note: WordPress aims to maintain backward compatibility with PHP, and updating core software should not significantly impact websites running older PHP versions. Nevertheless, always ensure your website is backed up before performing major updates.

Check MySQL PHP Extension Status in WordPress Health Tool

WordPress admins can utilize the built-in Health Tool to determine the status of PHP and MySQL extensions:

1. Log into the WordPress Dashboard.

2. Go to Tools and select Site Health.

3. Click the Info tab.

Site health information in WordPress.

4. Expand the Server section to check the PHP version. In this example, the PHP version is 8.2.12.

Finding the PHP version in WordPress.

If the PHP version is older than 7.4, you can:

  • Contact the web host and ask them to update PHP.
  • Use the web host's server management interface, such as cPanel, to update PHP.
  • SSH into the WordPress server and update PHP from the command line.

5. Next, access the Database section to check if the MySQL extension for PHP is installed.

MySQL extension in Site Health in WordPress.

In this example, the mysqli extension is installed and active.

If the field is empty, the extension is missing and needs to be installed on the WordPress server. You can install the extension via the server's control panel or command line. Users looking for a less technical approach can contact the web host for assistance.

Check MySQL PHP Extension Status in info.php File

Users can also check the MySQL PHP extension status by connecting to the WordPress server using an FTP client, such as FileZilla, or a web hosting control panel, like Plesk or cPanel.

To check the extension status:

1. Navigate to the website's root directory (e.g., public_html) and create a new file called info.php.

2. Add the following PHP code to the info.php file:

<?php phpinfo(); ?>

3. Save the changes and exit the file.

4. View the file in a web browser by navigating to the following URL:

Replace with the actual domain of your website.

5. The server's PHP version is displayed at the top. PHP version 7.4 or newer is adequate, however, using the latest PHP 8.x version is recommended for improved performance and security.

PHP version in the info.php file.

6. Press Ctrl+F and search for mysqli and pdo_mysql sections in the info.php output to check if the MySQL extensions are enabled.

mysqli extension in the info.php file.

If the Client API library version field in the mysqli or pdo_mysql sections is empty, the MySQL extensions for PHP may be missing.

Typically, users manage PHP extensions via the server's control panel. Before installing or activating the missing MySQL extensions, contact the hosting provider for instructions specific to your hosting environment.

The exact steps may vary based on the control panel and hosting setup. For example, in Plesk, cPanel, or DirectAdmin, PHP extensions are managed in sections labeled Select PHP Version, PHP Options, or PHP Extensions. Users can easily enable or disable extensions by checking or unchecking the boxes next to the extension names.

Warning: Remove or protect the info.php file after reviewing the data, as it contains sensitive server configuration details.

Check MySQL PHP Extension Settings in php.ini File

Website updates or migrations can affect settings in PHP configuration files and lead to potential issues. The extension_dir setting impacts how WordPress locates PHP extensions and is a common cause of the Your PHP installation appears to be missing the MySQL extension which is required by WordPress error.

To verify the setting in the php.ini file:

1. Open the info.php file in a web browser and locate the Loaded Configuration File entry. This example shows the path to the active php.ini file for XAMPP on Windows:

php.ini path in the info.php file.

This path indicates the location of the PHP configuration file on your server.

2. Look for the extension_dir entry within the Core section on the same page to verify the directory PHP uses to load extensions. In this example, the path is:

Path to the extension_dir directory in the info.php file.

3. If the extension_dir field is incorrect or blank, open the php.ini file via the host's control panel or the command line and locate the extension_dir setting.

Update the extension_dir setting to reflect the correct path to your PHP extensions. Ensure it matches the directory path noted in the info.php file and that the line is not commented out.

Extension_dir setting in the php.ini file.

Note: PHP ignores lines that start with a semicolon (;). Add a semicolon at the start of a line in php.ini to disable specific settings without deleting them.

After making changes, save the file, exit the editor, and restart the web server for the changes to take effect.

Check MySQL PHP Extension Status from Command Line

Note: The examples in this section are presented using Ubuntu 22.04.. If your server runs a different Linux distribution or OS, use the appropriate commands for that system.

1. Log in to the server hosting the WordPress site locally or via SSH.

2. Check the installed PHP version using the following command:

php -v
Check PHP version in Ubuntu.

The system displays the currently installed PHP version.

3. Check whether the mysqli or PDO_MySQL extensions are installed by entering the following commands:

php -m | grep mysqli
php -m | grep pdo_mysql

The command searches through loaded PHP modules and filters the list for mysqli or pdo_mysql. If mysqli and pdo_mysql appear in the output, this confirms that the extensions are installed and active.

Checking for MySQL extensions in Ubuntu.

4. If the extensions are not installed, install them using the following commands:

sudo apt update
sudo apt install php-mysqli
sudo apt install php-pdo-mysql

Replace php-mysqli and php-pdo-mysql in the command with the version corresponding to your current PHP version. For example, type php8.0-mysqli or php8.0-pdo_mysql for systems using PHP 8.0.

5. To apply the changes, restart the web server. Depending on the web server type, use the appropriate command.

For Apache servers:

sudo systemctl restart apache2

For Nginx servers:

sudo systemctl restart nginx 

Revisit the WordPress website or specific feature that previously displayed the error to verify if the issue has been resolved.


This tutorial has outlined several ways to fix the Your PHP installation appears to be missing the MySQL extension error in WordPress.

You now know how to resolve an error by editing the php.ini file, which is helpful when troubleshooting other WordPress errors, such as the uploaded file exceeds the upload_max_filesize directive in php.ini.

Was this article helpful?
Vladimir Kaplarevic
Vladimir is a resident Tech Writer at phoenixNAP. He has more than 7 years of experience in implementing e-commerce and online payment solutions with various global IT services providers. His articles aim to instill a passion for innovative technologies in others by providing practical advice and using an engaging writing style.
Next you should read
How to Fix the 500 Internal Server Error in WordPress
April 25, 2024

Learn how to fix one of the most common errors you will encounter in WordPress, the 500 Internal Server Error.
Read more
How to Create & Edit the Default WordPress .htaccess File
March 20, 2024

The .htaccess file in WordPress is a configuration file for managing hyperlinks and making them more readable by both people and search engines. This guide helps you find, modify, and create a .htaccess file for WordPress.
Read more
How to Deploy WordPress Instance on Kubernetes
September 2, 2021

Deploying WordPress on Kubernetes is an efficient way to enable horizontal scaling of a website and successfully handle website traffic surges. This article demonstrates two methods to deploy WordPress on Kubernetes.
Read more
Database Security
March 30, 2023

Many unwanted database breaches and information compromises are avoidable when sticking to the best security practices. Learn how you can best secure your data to avoid disasters.
Read more