• 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)
  • Mysql driver was deprecated a long time ago. Which WordPress version are you using?

    Thread Starter TokoDaring.Com

    (@wpjakarta)

    Hi @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

    (@wpjakarta)

    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

    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

    (@wpjakarta)

    Hello,
    sory for late respons

    then, what part should i see from that report ?

    No prob

    You should see if mysqli 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 3 years, 9 months ago by wibergsweb.
    • This reply was modified 3 years, 9 months ago by wibergsweb.
    Thread Starter TokoDaring.Com

    (@wpjakarta)

    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.

    Yes it can absolutely be an issue! If you have caching plugin – REMOVE cache BEFORE deactivating (That’s more important than removing it).

    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

    @esneygarcia – what problem is it? ?? Is it the mysql error? What host are you using?

    • This reply was modified 3 years, 8 months ago by wibergsweb.

    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.