If the following error occurred, which means there is some problem with your PHP version or MySql extension.
Your PHP installation appears to be missing the MySQL extension, which is required by WordPress.
Cause of Error
Cause1. Using an older version of word press (< 3.9) with Latest version of PHP 7.0 or higher.
Cause2. PHP’s MySQL extension not installed
Cause3. PHP extension directory miss-configured
Case 1: Using an older version of word press (< 3.9) with Latest version of PHP 7.0 or higher
MySql extension is removed from PHP 7.0 or higher.
To fix this error, you can either update your Wordpress to the latest version or downgrade your PHP to lower version (5.4)
This error can also occur while updating the Wordpress Theme using older or equal to PHP version 5.4.
Update PHP Version through C-panel
Login to your C-panel, Scroll down to Select PHP Version Tab and update PHP Version to 5.6 or higher.
Problem while updating PHP version
If you are unable to update your PHP version due to shared hosting or permission issue, you must install the WordPress Plugin “MySqli.”
https://wordpress.org/plugins/mysqli/
This plugin helps to convert all your MySql query to MySqli query.
Case 2: PHP MySQL extension not installed
A. Check your PHP Version via SHH Command
Connect your server through SHH type command
php -v
B.Via Info.php file
Create an info.php file and following code and upload it on the root directory of the server.
<?php
phpinfo();
?>
Run this file through a web browser (http://www.yoursite.com/info.php). This will give the complete details of your PHP installation.
Now search for MySQL Support.
If you are not able to see “MySQL Support” details in the info.php file, which means MySql extension installation is missing.
PHP MySQL Installation on CentOS / RedHat / Oracle Linux:
PHP 5.x
# yum update
# yum install php-mysql
PHP 7.x
# yum update
# yum install php70w-mysql
PHP MySQL Installation on Ubuntu / Debian
PHP 5.x
# apt-get update
# apt-get install php5-mysqlnd
PHP 7.x
# apt-get update
# apt-get install php7.0-mysql
Restart Services
# service http restart; service apache restart; service apache2 restart; service nginx restart
Case 3: PHP extension directory miss-configured
To check Loaded Configuration File and extension_dir at http://www.yoursite.com/info.php file. Kindly Open web browser and open info.php file that we can create in case 2 and search for
A. extension_dir
B. Loaded Configuration File
Please make sure that extension_dir should point to correct extension path of your php installation directory.
This miss-configuration occurred in the following scenario:
1: Multiple version of php installed on the same server
2: custom php.ini.
Please comment below if you find any difficulty processing above.