Your PHP installation appears to be missing the MySQL extension which is required by WordPress

Your PHP installation appears to be missing the MySQL extension which is required by WordPress

If you get an error message like “Your PHP installation appears to be missing the MySQL extension which is required by WordPress” it means that the PHP installation on your server does not have the MySQL extension enabled. This is necessary for WordPress to connect to the MySQL database. If you want to follow up on this issue, follow these steps based on your server environment, and resolve the error Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

For Ubuntu/Debian

1. Update your package list

bash
sudo apt update

2. Install the PHP MySQL extension

For PHP 7. X:

bash
sudo apt install php7.x-mysql

Replace 7.x with your actual PHP version (e.g., 7.4).

For PHP 8.x:

bash
sudo apt install php8.x-mysql

Replace 8.x with your actual PHP version (e.g., 8.0).

3. Restart your web server:

For Apache:

bash
sudo systemctl restart apache2

For Nginx (if using PHP-FPM):

bash
sudo systemctl restart php7.x-fpm
sudo systemctl restart nginx

On CentOS/RHEL

1. Update your package list

bash
sudo yum update

2. Install the PHP MySQL extension

For PHP 7.x

bash
sudo yum install php7.x-mysqlnd

Replace 7.x with your actual PHP version (e.g., 7.4).

For PHP 8.x

bash
sudo yum install php8.x-mysqlnd

Replace 8.x with your actual PHP version (e.g., 8.0).

3. Restart your web server

For Apache

bash
sudo systemctl restart httpd

For Nginx (if using PHP-FPM)

bash
sudo systemctl restart php-fpm
sudo systemctl restart nginx

On Windows

1. Open your php.ini file:

The file is usually located in the PHP installation directory.

2. Enable the MySQL extension

Uncomment the following line by removing the leading semicolon (‘;’):

ini
;extension=mysqli

Now it should look like this:

ini
extension=mysqli

3. Restart your web server:

Restart your Apache or Nginx server to apply the changes.

Verifying the Extension

If you want to verify if the MySQL extension is enabled, then you can create a ‘phpinfo.php’ file in your web root directory with the following content:

php
<?php phpinfo(); ?>

Now, you can access this file through your web browser (http://yourdomain.com/phpinfo.php) and look for a section titled ‘mysqli.’ If you see this section, then the MySQL extension is enabled.

Additional Troubleshooting

  • You have to make sure PHP is properly installed: Verify that PHP is correctly installed and configured on your server.
  • You can check for multiple PHP versions: But make sure that the correct PHP version is being used by your web server, especially if multiple PHP versions are installed on the server.

These steps should resolve the issue and allow WordPress to connect to the MySQL database.

Leave a Comment

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