How to fix Missing MySQL Extension Error in WordPress
If you are setting up WordPress on a new Linux VPS server for the first time, then you may run into some problems like missing some PHP extensions. One example is the lack of a MySQL extension, this is a common problem as the extension is not included by default with many operating systems. In this article, we will guide you on how to solve the missing extension issue and complete the WordPress installation successfully.
The missing PHP extension isn’t such a big deal. If you see the following message on the screen while trying to access the WordPress installation through a web browser, then you are one of many WordPress users who have faced this same issue.
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
To fix this problem, you must have SSH access to the server. Connect to Linux VPS via SSH network protocol and check the current PHP version that is currently in use:
php -v
You can also check your current PHP version by creating a simple file info.php
in the directory public_html
with the following content:
<?php phpinfo(); ?>
After creating and saving the file, open your favorite web browser and access the file by typing http: //your_domain.ru/info.php at the command line.
If you are running an Ubuntu VPS server and,PHP 7
then run the following commands at the command prompt:
apt-get update apt-get install php7.0-mysql
Then restart the Apache service for the changes to take effect, or if you are using the Nginx + PHP-FPM bundle, then restart the PHP-FPM service.
In case you are working with PHP 5
, run the following commands:
apt-get update apt-get install php-mysql
Restart the appropriate service for the changes to take effect.
To search for all available packages containing in mysql
, you can use the following command in Ubuntu:
apt-cache search mysql
On the other hand, if you are running a CentOS VPS server and you have installed PHP 7
on the server, then run the following commands to fix this problem:
yum update yum install php70w-mysql
Restart Apache or PHP-FPM in case you are using Nginx + PHP-FPM as your web server.
If you installed PHP 5
on your CentOS server, run the following commands:
yum update yum install php-mysql
Restart the appropriate service for the changes to take effect on the server.
To search for all available packages contained in mysql
, you can use the following command on CentOS:
yum search mysql
After you install the MySQL PHP extension, the missing extensions message should no longer appear and you can proceed with the WordPress installation.