• WP 5.6 and after upgrading to PHP 8 following error occurs:

    (removed paths)

    [STDERR] PHP
    Fatal error:  Uncaught Error: Call to undefined function mysql_connect()
    in
    wp-db.php:1688
    Stack trace:
    #0
    wp-db.php(632):
    wpdb->db_connect()
    #1
    load.php(527):
    wpdb->__construct()
    #2
    wp-settings.php(124):
    require_wp_db()
    #3
    wp-config.php(88):
    require_once('/home/khaotipth...')
    wp-load.php(37):
    require_once('/home/khaotipth...')
    #5
    wp-blog-header.php(13):
    require_once('/home/khaotipth...')
    index.php(17):
    require('/home/khaotipth...')
    #7 {main}
       thrown in
    wp-db.php
    on line 1688

    disabled all plugins and changed to Twenty Twenty-One (twentytwentyone).

    Version 5.6
    Site Language sv_SE
    User Language en_US
    Timezone Europe/Stockholm
    Permalink structure /%category%/%postname%/
    Is this site using HTTPS? Yes
    Is this a multisite? No
    Can anyone register on this site? No
    Is this site discouraging search engines? Yes
    Default comment status Closed
    Environment type production
    User count 6
    Communication with www.ads-software.com www.ads-software.com is reachable

    Maria DB 10.3 and hosting provider using cloudlinux
    And yes I am aware of beta compatibility for PHP8 in WP 5.6

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Yui

    (@fierevere)

    永子

    Check your server’s PHP configuration (php.ini)
    you need to enable mysqli extension.

    If you have used PHP 5.6 and earlier , you may have used mysql extension, PHP7+ does not have it, you shall enable and use mysqli
    WordPress will use it automatically

    Thread Starter Jarko Piironen

    (@ipajen)

    @fierevere Sorry I forget to mention that I upgraded from PHP 7.4 to PHP 8

    Moderator Yui

    (@fierevere)

    永子

    Perhaps configuration has reset to stock php.ini on update.
    You shall check if you have mysqli enabled for PHP 8.0

    WordPress tries first
    mysqli (mysqli_connect)
    if not available then
    mysql (mysql_connect)
    if not available – fatal error.

    Thread Starter Jarko Piironen

    (@ipajen)

    @fierevere
    when upgrading to PHP 8 the mysqli and mysqlnd in PHP Extensions is ticked.
    (Cant find any PHP.ini in my directories)

    As using PHP 7.4 before upgrading, should mysqli/mysql be a issue?

    Moderator Yui

    (@fierevere)

    永子

    Unlikely.

    mysqlnd is a backend extension, its used by interface extensions: mysql (old, deprecated), mysqli, mysql pdo (WP does not use PDO)

    other possible variant to mysqlnd is – mysqlclient library (older and less efficient, but still can be offered by your OS distributors)

    You need to enable
    mysqli
    mysqlnd

    A little advice: PHP 7.4 is great. Running fresh PHP 8.0 is taking the risk of testing new features and new incompatabilities. There are many plugins and themes not ready for PHP 8 yet. If you are taking the risk of testing – make sure you will report bugs to WP Core trac and to plugins and theme authors.
    If you just want to run WP smoothly – use PHP 7.3 – PHP 7.4 for now.
    (PHP 7.2 is good too, but it will EOL soon)

    Thread Starter Jarko Piironen

    (@ipajen)

    Yes mysqli and mysqlnd are ticked/enabled already.

    Thread Starter Jarko Piironen

    (@ipajen)

    Closing ticket as found solution in:
    https://core.trac.www.ads-software.com/ticket/51988

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘PHP 8 and WP 5.6 – PHP Fatal error: Uncaught Error: Call to undefined function’ is closed to new replies.