-3

My WP site is currently on php 5.6, but when updated to PHP7, I get the following fatal message and the white screen of death.

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/s7280o8m/public_html/wp-includes/wp-db.php:1568 Stack trace: #0 /home/s7280o8m/public_html/wp-includes/wp-db.php(658): wpdb->db_connect() #1 /home/s7280o8m/public_html/wp-includes/load.php(404): wpdb->__construct('s7280o8m_wp891', 'K(p64@S137', 's7280o8m_wp891', 'localhost') #2 /home/s7280o8m/public_html/wp-settings.php(106): require_wp_db() #3 /home/s7280o8m/public_html/wp-config.php(90): require_once('/home/s7280o8m/...') #4 /home/s7280o8m/public_html/wp-load.php(37): require_once('/home/s7280o8m/...') #5 /home/s7280o8m/public_html/wp-blog-header.php(13): require_once('/home/s7280o8m/...') #6 /home/s7280o8m/public_html/index.php(17): require('/home/s7280o8m/...') #7 {main} thrown in /home/s7280o8m/public_html/wp-includes/wp-db.php on line 1568

F.Y.I :

  1. Ran the PHP7 compatibly test and the plugins + theme were all good.

  2. In trying solve the fatal error, I have deactivated all the plugins (one by one) and then re-activate (one by one), plus changed the theme, but the problem still persists.

Really would appreciate any help on this.

Mousa Alfhaily
  • 1,260
  • 3
  • 20
  • 38
ClaudioF1
  • 1
  • 1
  • 2

2 Answers2

3

You seem to be using pretty ancient installation of your Wordpress as mysql extension was deprecated for a long time and is removed from PHP7 completely. New code uses mysqli (directly or via PDO), you need to upgrade your Wordpress to recent codebase. Or downgrade PHP.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
0

Are you sure that you are running the latest version of WordPress? (at the time of writing the current version is 4.8.1, you can download it from this page: https://wordpress.org/download/)

It looks like you're running an outdated version because it refers to the mysql_connect function which has been deprecated in PHP 5.5.0 and totally removed in PHP 7.0 (as you can see here).

Also check for any plug-in installed which may be outdated: rename the plugins directory inside of wp-content if you want to disable every plugin at once.

Reddalo
  • 106
  • 7