Knowledge Base
MilesWeb / Database

PHP Installation Appears To Be Missing the MySQL Extension

Approx. read time : 2 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:

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

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:

php -v

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:

<?php phpinfo(); ?>

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:

apt-get update
apt-get install php7.0-mysql

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:

apt-get update
apt-get install php-mysql

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:

apt-cache search mysql

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:

yum update
yum install php70w-mysql

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:

yum update
yum install php-mysql

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:

yum search mysql

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.

Trusted By Thousands of Clients & Big Businesses

We highly appreciate the kind and stellar feedback we receive from our customers. Delivering the best is our goal! MilesWeb is rated Excellent out of 5 based on reviews. Read more reviews.

Excellent
Based on reviews
2 hours ago
Perfect and Valuable Server + ...
I am using MilesWeb Servers, The main thing which I getting are continuous support over everything w...
Gunjan Makwana
4 hours ago
Milesweb is superb Hosting pro...
Milesweb is superb Hosting provider ever, their Support team is amazing!!!...
Abhishek Singh
15 hours ago
Great support in great timing...
We need urgent assistance on changes in a primary domain on our client's Cpanel accounts and reached...
Riyaju Deen
21 hours ago
Best Website Hosting platform ...
I was new on MilesWeb. And needed help on multiple areas from setting up to getting started with cre...
Harshada
1 days ago
Very quick and helpful assista...
Very quick and helpful assistance. Support person listened properly and provided a nice solution....
Narendra
1 days ago
the team is very supportive th...
the team is very supportive though at times effort needs to be made to make understand the problem s...
Suree Sharma
1 days ago
I am using miles web for 3plus...
I am using miles web for 3plus years, very quick and perfect support by the team, they helped me man...
Sri Raghav
2 days ago
The service is good...
The service is good. They are answering with patience and doing the needful as soon as possible....
MR
2 days ago
Perfect and Valuable Server + ...
I am using MilesWeb Servers, The main thing which I getting are continuous support over everything w...
Gunjan Makwana
3 days ago
Very quick and helpful assista...
Very quick and helpful assistance. Support person listened properly and provided a nice solution....
Narendra
4 days ago
positively helped me with find...
positively helped me with finding insecure content on my website causing SSL to not work properly on...
Thaviraj Junglee
4 days ago
Exceptional support, Truly Pra...
I had opted for the basic wordpress hosting plan as I intended to experiment with various plug-ins. ...
Aseem Chandna