Title: Fatal error with WordPress Update
Last modified: August 24, 2021

---

# Fatal error with WordPress Update

 *  [digilscape](https://wordpress.org/support/users/digilscape/)
 * (@digilscape)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/fatal-error-with-wordpress-update/)
 * Hi All, We are having a “Critical error message” on the wordpress website most
   likey to be caused by WordPress 5.8 upgrade. Debug code as below:
 *     ```
       Fatal error: Uncaught Error: Call to undefined function mysql_connect() in
       /var/www/website/wp-includes/wp-db.php:1685 Stack trace: #0
       /var/www/website/wp-includes/wp-db.php(632): wpdb->db_connect() #1
       /var/www/website/wp-includes/load.php(545): wpdb->__construct('wordpress_65', 'v24ZuPNr1_', 'client_5fc0585_...', 'localhost:3306') #2 
       /var/www/website/wp-settings.php(124): require_wp_db() #3
       /var/www/website/wp-config.php(108): require_once('/var/www/vhosts...') #4
       /var/www/website/wp-load.php(37): require_once('/var/www/vhosts...') #5
       /var/www/website/wp-admin/admin.php(34): require_once('/var/www/vhosts...') #6
       /var/www/website/wp-admin/index.php(10): require_once('/var/www/vhosts) #7
       {main} thrown in /var/www/website/wp-includes/wp-db.php on line 1685
       ```
   
 * We have tried turning off plugins and themes as suggested by many online, but
   it didn’t help. Looked at PHP settings too, it’s mysqli enabled, etc.
 * We have restored the website to the previous version and is working fine now.
 * Can you please suggest what to do?
    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Glen Davies](https://wordpress.org/support/users/glendaviesnz/)
 * (@glendaviesnz)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/fatal-error-with-wordpress-update/#post-14797927)
 * Did also check that `define('WP_USE_EXT_MYSQL', true);` is not defined in wp-
   config [https://wordpress.org/support/topic/php-fatal-error-uncaught-error-call-to-undefined-function-mysql_connect-in/#post-10569776](https://wordpress.org/support/topic/php-fatal-error-uncaught-error-call-to-undefined-function-mysql_connect-in/#post-10569776)?
    -  This reply was modified 4 years, 9 months ago by [Glen Davies](https://wordpress.org/support/users/glendaviesnz/).
    -  This reply was modified 4 years, 9 months ago by [Glen Davies](https://wordpress.org/support/users/glendaviesnz/).
 *  Thread Starter [digilscape](https://wordpress.org/support/users/digilscape/)
 * (@digilscape)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/fatal-error-with-wordpress-update/#post-14798109)
 * [@glendaviesnz](https://wordpress.org/support/users/glendaviesnz/) – Thanks for
   your reply. Yes, have checked that. That line is not there in the config file.
 *  [Tamas Miletics](https://wordpress.org/support/users/tmiletics/)
 * (@tmiletics)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/fatal-error-with-wordpress-update/#post-14798807)
 * Hello,
 * I think you should check the enviroment and the php functions before the upgrade.
   
   Try to modify the wp-includes/wp-db.php file: (from line 612)
 * original:
    —
 *     ```
       // Use ext/mysqli if it exists unless WP_USE_EXT_MYSQL is defined as true.
       		if ( function_exists( 'mysqli_connect' ) ) {
       			$this->use_mysqli = true;
   
       			if ( defined( 'WP_USE_EXT_MYSQL' ) ) {
       				$this->use_mysqli = ! WP_USE_EXT_MYSQL;
       			}
       		}
       ```
   
 * —
 * for the check:
 * —
 *     ```
       // Use ext/mysqli if it exists unless WP_USE_EXT_MYSQL is defined as true.
       echo "checking mysqli ... \n";
       		if ( function_exists( 'mysqli_connect' ) ) {
       			$this->use_mysqli = true;
       echo "mysqli found ... \n";
       			if ( defined( 'WP_USE_EXT_MYSQL' ) ) {
       				$this->use_mysqli = ! WP_USE_EXT_MYSQL;
       echo "disable mysqli \n";
       			}
       		}
       ```
   
 * —
 * After it you will see (on a reloaded page) the statuses of the checking functions…
 * Tom Miletics
 * Developer
    You can contact me privately: [http://www.mile.hu](https://www.mile.hu/hiba-bejelentes/)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Fatal error with WordPress Update’ is closed to new replies.

## Tags

 * [fatal error](https://wordpress.org/support/topic-tag/fatal-error/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [Tamas Miletics](https://wordpress.org/support/users/tmiletics/)
 * Last activity: [4 years, 9 months ago](https://wordpress.org/support/topic/fatal-error-with-wordpress-update/#post-14798807)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
