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

江枫思渺然 提交于 2019-11-27 01:19:01

The php mysql api is deprecated. It's kaput --- going away -- not to be used, finito.

If you have a modern version of PHP (> 5.6) then Wordpress should automatically switch to make use of mysqli. That should be your first attempt.

If you can not update your php, rather than attempting to resurrect something that php no longer supports, just patch your wordpress: http://wordpress.org/plugins/mysqli/

in the end i found a solution First, make sure MySQL server is running. Type the following command at a shell prompt: # /etc/init.d/mysql status

If MySQL is not running, enter: # /etc/init.d/mysql start

If MySQL is not installed, type the following command to install MySQL server: # apt-get install mysql-server

Make sure MySQL module for php5 is installed: # dpkg --list | grep php5-mysql

To install php5-mysql module enter: # apt-get install php5-mysql

Next, restart the Apache2 web server: # /etc/init.d/apache2 restart

ashishyadaveee11

This MySQL library worked for me:

sudo apt-get install php5-mysqlnd-ms

Check the

extension_dir =

remove it if it is there. that should fix the problem.

If you have Wordfence plugin installed I found commenting out the suPHP_ConfigPath lines in the .htaccess file brought the website back to life:

# Wordfence WAF
#<IfModule mod_suphp.c>
#   suPHP_ConfigPath '/home/a1614947/public_html'
#</IfModule>

I've reported this to Wordfence too.

When you upgarde your php version, make sure, apache2 follows. You can create a phpinfo() file which could show that apache is still using the old php version.

In this case you should use the a2dismod php-old-version and a2enmon php-mod-version commands

Exemple :

in ubuntu, your grab the old version from /etc/apache2/mods-enabled, or from the version shown by the phpinfo file, and you grab the new one from /etc/apache2/mods-available

> sudo a2dismod php5.6
> sudo a2enmod php7.1
> sudo service apache2 restart

This Error is created by the WP core file /wp-includes/load.php and the function name is wp_check_php_mysql_versions().

The older versions of the WP does not support MySqli. But the latest WP versions support both MySql and MySqli extensions without bothering installed PHP versions.

Solved my problem 100%

In my case, I just updated the Wordpress core files manually and solved the issue :)

subhash Porje

If people are using shared Linux hosting with cPanel (Godaddy, Reseller club, Hostgator or any Shared Hosting), try the following:

Under Software and Services tab -> Select PHP Version -> PHP Selectors | Extentions

Tick all MySQL related extensions, save it and you are done. Please check the attached image.

It maybe the reason The php mysql api is deprecated. if your using below < PHP5.5 just update in your server to 5.6 and above.

Ng Zhong Qin

I'm using Fedora 25

sudo dnf search php | grep mysql

php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
php-pear-MDB2-Driver-mysqli.noarch : MySQL Improved MDB2 driver mysqli

sudo dnf install php-mysqlnd.x86_64

In my case, using CPanel PHP selector and selecting the mysqli and mysqlnd worked. Ensure to save and recheck once

I had same issue as mentioned " Your PHP installation appears to be missing the MySQL extension which is required by WordPress" in resellerclub hosting.

I went through this thread and came to know that php version should be greater than > 5.6 so that wordpress will automatically gets converted to mysqli

Then logged into my cpanel searched for php in cpanel to check for the version, luckly was able to find that my version of php was 5.2 and changed that to 5.6 by making sure mysqli is tick marked in the option window and saved it is working fine now.

This issue was due to lack of database. If it is a fresh installation, you need to manually create one and assign user with privileges.

Please check in wp-config.php for any bad configurations and make sure that database and tables are not missing or corrupted.

Just install apt-get install php5-mysqlnd Restart Apache service apache2 restart

Make sure you tick Mysqli and mysqlnd as shown in the screenshot

Jason Torremocha

When I upgraded my website PHP from version 5.6 to 7.2, I encountered this problem “Your PHP installation appears to be missing the MySQL extension which is required by WordPress”. It turns out that mysql extension is no longer supported in PHP version 7.2. It is now using mysqli extention. I am using old version of WordPress which still using mysql extension that is why the problem existed. So what I did is upgraded the WordPress to the core. This solve the problem.

Here's the steps I followed when upgrading WordPress manually.

  1. First I created a full backup of my website. This is very important in case of mistake.
  2. I download the newest WordPress ZIP file from wordpress.org.
  3. I unzipped the file into a local directory of my computer.
  4. I went to my website root directory and deleted your ‘wp-includes’ and ‘wp-admin’ directories. I used sFTP connection using Filezilla software.
  5. I uploaded the new wp-includes and wp-admin directories from the new version of WordPress I unzipped to my website root directory and replaced the directories I just deleted.
  6. I did not delete the wp-content directory or any of the files in that directory. I just copied over the files from the wp-content directory in the new version of WordPress to my existing wp-content directory. All existing files with the same name have been overwritten.
  7. I copied all files from the root (‘/’) directory of the new version of WordPress that I unzipped into my website root directory (or the root directory of your WordPress installation). Existing files has been overwritten and new files has been copied across. wp-config.php file was not be affected because WordPress has never distributed with a wp-config.php file.
  8. I compare wp-config-sample.php which was distributed with WordPress but did not find anything to change so I just used the old one.
  9. I cleared my browser cache to ensure I can see all changes.
  10. I checked the site and there is no error now. The upgrade was completed.

For php 5.6 sudo apt-get install php5.6-mysqlnd-ms and restart your apache

/etc/init.d/apache2 restart

The source of this message was unrelated to the solution in my case.

My ip address of my server changed and i didn't change the <VirtualHost> directive in my httpd.conf of the apache server.

Once i changed it to the correct ip address the message disappeared and Wordpress is working again.

I have resolved the issue just adding following code in .htaccess file. I hope this will work for you guys also.

Step 1: Change the PHP version form the server.

Step 2: Add the following code in your .htaccess file according to your PHP version (Selected from the server).

To switch to PHP 4.4:

AddHandler application/x-httpd-php4 .php

To switch to PHP 5.0:

AddHandler application/x-httpd-php5 .php

To switch to PHP 5.1:

AddHandler application/x-httpd-php51 .php

To switch to PHP 5.2:

AddHandler application/x-httpd-php52 .php

To switch to PHP 5.3:

AddHandler application/x-httpd-php53 .php

To switch to PHP 5.4:

AddHandler application/x-httpd-php54 .php

To switch to PHP 5.5:

AddHandler application/x-httpd-php55 .php

To switch to PHP 5.6:

AddHandler application/x-httpd-php56 .php

To switch to PHP 7:

AddHandler application/x-httpd-php7 .php

To switch to PHP 7.1:

AddHandler application/x-httpd-php71 .php 

On Oracle Linux 7.x running PHP version 7.3.x you need to run sudo yum install php-mysqlnd in order to install the missing MySQL extension for PHP.

Remember to restart PHP and or your server for the changes to take effect.

For me (ubuntu 16.04) the winner was:

sudo apt install php7.0-mysql

I just removed custom php ini, which I don't use at all. The problem gone, site is working fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!