Title: error when switch to php 8
Last modified: February 17, 2021

---

# error when switch to php 8

 *  [TokoDaring.Com](https://wordpress.org/support/users/wpjakarta/)
 * (@wpjakarta)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/error-when-switch-to-php-8/)
 * Hello
 * since my hosting provider declared that it’s safe to move to php 8, then i tried
   to switch to php 8.
 * unfortunatelly i got an error, based my debug.log this is the error reported
 *     ```
       [17-Feb-2021 03:32:58 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /home/xxxxxxx/public_html/wp-includes/wp-db.php:1685
       Stack trace:
       #0 /home/xxxxxxx/public_html/wp-includes/wp-db.php(632): wpdb->db_connect()
       #1 /home/xxxxxxx/public_html/wp-includes/load.php(527): wpdb->__construct()
       #2 /home/xxxxxxx/public_html/wp-settings.php(124): require_wp_db()
       #3 /home/xxxxxxx/public_html/wp-config.php(97): require_once('/home/xxxxxxx/...')
       #4 /home/xxxxxxx/public_html/wp-load.php(37): require_once('/home/xxxxxxx/...')
       #5 /home/xxxxxxx/public_html/wp-blog-header.php(13): require_once('/home/xxxxxxx/...')
       #6 /home/xxxxxxx/public_html/index.php(17): require('/home/xxxxxxx/...')
       #7 {main}
         thrown in /home/xxxxxxx/public_html/wp-includes/wp-db.php on line 1685
       ```
   
 * i’am using storefront theme and very minimal plugin.

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

 *  [wibergsweb](https://wordpress.org/support/users/wibergsweb/)
 * (@wibergsweb)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/error-when-switch-to-php-8/#post-14061409)
 * Mysql driver was deprecated a long time ago. Which WordPress version are you 
   using?
 *  Thread Starter [TokoDaring.Com](https://wordpress.org/support/users/wpjakarta/)
 * (@wpjakarta)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/error-when-switch-to-php-8/#post-14061777)
 * Hi [@wibergsweb](https://wordpress.org/support/users/wibergsweb/) thank for your
   reply
 * my WordPress version is 5.6.1
    i think that is the latest version of WordPress
 *  Thread Starter [TokoDaring.Com](https://wordpress.org/support/users/wpjakarta/)
 * (@wpjakarta)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/error-when-switch-to-php-8/#post-14063538)
 * i have tried to deactivating all plugin
    then re-install WordPress. but still
   the same. inside wp-db.php still call deprecated `mysql_connect()` function
 *  [wibergsweb](https://wordpress.org/support/users/wibergsweb/)
 * (@wibergsweb)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/error-when-switch-to-php-8/#post-14064680)
 * This _looks like_ the `mysqli()` **is not loaded**_ on the server and therefore`
   mysql()` is used instead. __This seems to be a misconfiguration on the server._
 * Just to be sure…. Can you create a file
 * <?php
    phpinfo();
 * and print it out on the server where you have your website?
 *  Thread Starter [TokoDaring.Com](https://wordpress.org/support/users/wpjakarta/)
 * (@wpjakarta)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/error-when-switch-to-php-8/#post-14071863)
 * Hello,
    sory for late respons
 * then, what part should i see from that report ?
 *  [wibergsweb](https://wordpress.org/support/users/wibergsweb/)
 * (@wibergsweb)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/error-when-switch-to-php-8/#post-14072130)
 * No prob
 * You should see if mysql**i** is activated. (not only mysql driver). Search for
   mysqli when viewing your report.
    ** If you don’t get a result_ , mysqli is not
   activated on the server. (which it should be)._
    -  This reply was modified 5 years, 3 months ago by [wibergsweb](https://wordpress.org/support/users/wibergsweb/).
    -  This reply was modified 5 years, 3 months ago by [wibergsweb](https://wordpress.org/support/users/wibergsweb/).
 *  Thread Starter [TokoDaring.Com](https://wordpress.org/support/users/wpjakarta/)
 * (@wpjakarta)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/error-when-switch-to-php-8/#post-14072990)
 * yes, it’s activated, i can see it from the report or also from the php selector
   option
    mysqli also activated when i switched to php 8
 * my question, does this problem can be caused by the caching plugin ?
    if yes 
   i will try to delete the plugin first (not only deactivate). i just need to wait
   the right time to do that.
 *  [wibergsweb](https://wordpress.org/support/users/wibergsweb/)
 * (@wibergsweb)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/error-when-switch-to-php-8/#post-14075796)
 * Yes it can absolutely be an issue! If you have caching plugin – REMOVE cache 
   BEFORE deactivating (That’s more important than removing it).
 *  [esneygarcia](https://wordpress.org/support/users/esneygarcia/)
 * (@esneygarcia)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/error-when-switch-to-php-8/#post-14158769)
 * Hello, you managed to solve the problem, I updated the wordpress to the latest
   version and then the PHP and the same problem occurred, I had almost no plugin
   installed, the site is new, I had not even started to create
 *  [wibergsweb](https://wordpress.org/support/users/wibergsweb/)
 * (@wibergsweb)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/error-when-switch-to-php-8/#post-14158949)
 * [@esneygarcia](https://wordpress.org/support/users/esneygarcia/) – what problem
   is it? 🙂 Is it the mysql error? What host are you using?
    -  This reply was modified 5 years, 3 months ago by [wibergsweb](https://wordpress.org/support/users/wibergsweb/).
 *  [michaeltaiwan](https://wordpress.org/support/users/michaeltaiwan/)
 * (@michaeltaiwan)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/error-when-switch-to-php-8/#post-14598288)
 * Got exactly the same problem few days after upgrading to PHP 8
    wp-login.php 
   shows: “`There has been a critical error on this website. Fatal error: Uncaught
   Error: Call to undefined function mysql_connect() in /home/ndoajyxx/phil.cyou/
   wp-includes/wp-db.php:1685 Stack trace: #0`
 * I could not reach the WP Dashboard, even the WP RESET Emergency login did not
   work!!!
 * MY SOLUTION:
    in my host provider (WebHostFace.com) in CPANEL=> PHP SELECTOR 
   => EXTENSIONS I activated (I checked the boxes): nd_mysqli nd_pdo_mysql
 * Check PHP VERSION 8! because for each version of PHP, the extensions are different!
   
   and then IT WORKS, websites came back!!! Not even needed to refresh the tab. 
   Do not ask me why. I just read something about mysqli in the thread above and
   I searched and tried 26 June 2021 Michael Web Taiwan

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

The topic ‘error when switch to php 8’ is closed to new replies.

## Tags

 * [php 8](https://wordpress.org/support/topic-tag/php-8/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 11 replies
 * 4 participants
 * Last reply from: [michaeltaiwan](https://wordpress.org/support/users/michaeltaiwan/)
 * Last activity: [4 years, 11 months ago](https://wordpress.org/support/topic/error-when-switch-to-php-8/#post-14598288)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
