Knowledge Base
MilesWeb / Database

PHP Installation Appears To Be Missing the MySQL Extension

Approx. read time : 3 min

“PHP installation appears to be missing the MySQL extension” is a common error in WordPress, if you are setting up a WordPress CMS on a new Linux VPS. You get the message of missing MySQL extension because this extension isn’t by default available in many operating systems. In this tutorial, you will learn to fix this problem and complete the WordPress installation successfully.

Don’t get panic if you get the missing a PHP extension error. If you see the below message on your screen while accessing the WordPress installation via web browser, then you are one of the many WordPress users that face the same problem:

Follow the below steps to solve this error:

Connect via SSH and Check the PHP Version

Ensure that you have a SSH access to the server. Using SSH, connect to your Linux VPS and check the PHP version that you are currently using:

Create Info.php File

Alternate way of checking the PHP version is by creating a simple info.php file in your public_html directory with the below content:

After creating the file, open your choice of web browser and access the file.

Update the Required Packages

In case you are running an Ubuntu VPS and PHP 7, then execute the following commands:

Restart the Web Server

Next, you will need to restart your Apache service for the changes to take effect, or in case you are using Nginx + PHP-FPM, then you will need to restart the PHP-FPM service.

Update PHP

If you are running PHP 5, run the below commands:

Then you should restart the appropriate service for the changes to take effect.

Search All the Available Packages Containing MySQL

In order to search all the available packages that contain mysql, you can use the below command:

Or, if you are running a CentOS VPS that contains PHP 7 installed on the server, then execute the below commands to fix the error:

Restart Apache

You will need to restart Apache or the PHP-FPM service if you are using Nginx + PHP-FPM as a web server.

If PHP 5 is installed on your CentOS server, execute the following commands:

Then you should restart the appropriate service for the changes to take effect.

In order to search all the available packages containing mysql, you can execute the following command:

After installing the MySQL extension for PHP, you can switch back to your WordPress setup. If the installation goes OK, the message about the missing MySQL extension won’t appear. You can then continue with your WordPress setup.

Pallavi is a Digital Marketing Executive at MilesWeb and has an experience of over 4 years in content development. She is interested in writing engaging content on business, technology, web hosting and other topics related to information technology.
Need help? We’re always here for you.