6

My website uses the latest WordPress version, all of a sudden I start getting this error. I try to disable all the plugin via database but same error. Any help

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/website/public_html/wp-includes/wp-db.php on line 1568

Warning: Cannot modify header information – headers already sent by (output started at /home/website/public_html/wp-includes/wp-db.php:1568) in /home/website/public_html/wp-includes/pluggable.php on line 1195

Gufran Hasan
  • 8,910
  • 7
  • 38
  • 51
meandme
  • 2,477
  • 2
  • 21
  • 20
  • what is the php version this is running under? – Funk Forty Niner May 08 '17 at 15:09
  • php version 5.6 – meandme May 08 '17 at 15:20
  • This means your WordPress install isn't detecting `mysqli` as being installed. Make sure it's installed and turned on. – ceejayoz May 08 '17 at 16:00
  • This [PHP 7.1.x - mysqli_connect Isn't Defined (Extension is turned on)](http://stackoverflow.com/q/43848269/1415724) might be relevant; it was posted today. Have a look at that Q&A. – Funk Forty Niner May 08 '17 at 16:16
  • i remove define( 'WPCACHEHOME', '/home/website/public_html/wp-content/plugins/wp-super-cache/' ); //Added by WP-Cache Manager in wp-config.php...and somewhat all is working well again. – meandme May 08 '17 at 16:54
  • 2
    php version 5.6 is past end of life and no longer even gets security updates - upgrade to a supported version of PHP. – Quentin Mar 07 '19 at 15:39

1 Answers1

0

This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead The issue with MySQL connection can be caused due to different cause, solving this can be a little tricky, in my case the problem was the PHP version if you will use PHP 5.4 ( end of life ) I think you will not see any of this error, because in php5.4 the mysql_connect is an updated function.

Anyway here there are some steps on how to solve this issue:

  • First, use the latest PHP version, You can change it through your hosting account.
  • If the first solution does not work, Deactivate all the plugins by renaming the plugins folder to a new one plugins.new or something different, if you have an FTP connection.
  • If the above solutions does not work, try renaming the activated the theme, so WordPress will choose the default one.
  • If also the theme does not work try to reset the .htaccess to the default one. As I mentioned before please check the PHP version, if you use PHP 5.4 you will not have any problem.
Nmk
  • 1,281
  • 2
  • 14
  • 25