# Fixing "Your PHP installation appears to be missing the MySQL extension"

> WordPress says your PHP installation is missing the MySQL extension. Here's how to turn the extension on, or switch to a PHP version WordPress supports.

Source: https://helpcenter.ruachost.com/wordpress/guides/fixing-missing-mysql-extension-error-in-wordpress/

WordPress shows **"Your PHP installation appears to be missing the MySQL extension which is required by WordPress"** when PHP can't talk to your database. It usually appears after a PHP version change, or after moving a very old site.

## 1. Turn on the mysqli extension

1. Log in to cPanel and open **Select PHP Version** under **Software**.
2. Open the **Extensions** tab.
3. Make sure **mysqli** (or **nd_mysqli**) and **mysqlnd** are ticked. Also tick **pdo_mysql** if your site uses it.
4. Reload your website.

Each PHP version has its own extension list, so check again whenever you change PHP version.

## 2. Use a PHP version your WordPress supports

- **Modern WordPress** (6.x) works best on **PHP 8.2 to 8.4**.
- **Very old WordPress** (older than 3.9) uses the old `mysql_` functions, which were removed in PHP 7. The error appears on any PHP 7 or 8 version.

For a very old site, **update WordPress** rather than going back to an old, insecure PHP version. Take a backup first. If you can't update right away, switch to the PHP version the site used before in **Select PHP Version**, then plan the update.

See [Changing your PHP version and settings](https://helpcenter.ruachost.com/cpanel/software/changing-php-versions-and-settings-using-php-selector/).

## 3. Check for leftover handler lines

If the extension is on but the error remains, an old line in `.htaccess` may be forcing a different PHP version. In File Manager, turn on **Show Hidden Files**, open `.htaccess` and remove any `AddHandler` or `SetHandler` lines that mention PHP.

## Related articles

- [Common PHP errors and how to fix them](https://helpcenter.ruachost.com/developers/php/common-php-errors/)
- [Fixing "Error establishing a database connection"](https://helpcenter.ruachost.com/cpanel/databases/error-establishing-a-database-connection/)
