Support » Fixing WordPress » MySQL connect requests causing fatal error on php 7.2 and 7.3 in wordpress files

  • Resolved djusstattoo

    (@djusstattoo)


    These are all files present in the latest wordpress update. One of them is requiering MySQL connect wich has been removed from php 7.2 and 7.3. It is blocking wp-admin access but the website works well. Just wp-admin on pages page and extentions page for php 7.2 and same error log on all wp-admin pages with php 7.3.
    MySQLI is active MariaDB is up to date. On another forum they say to replace MYSQL connect function . by MySQLi connect… Look: They say:

    “You can use mysqli_connect($mysql_hostname , $mysql_username) instead of mysql_connect($mysql_hostname , $mysql_username).

    mysql_* functions were removed as of PHP 7. You now have two alternatives: MySQLi and PDO.”

    Why should I have to change this in wordpress files? It’s not a plugin and not the theme cause the website is online and accessible.
    wp-includes/wp-db.php:1564
    wp-includes/wp-db.php(592)
    wp-includes/load.php(409)
    public_html/wp-settings.php(106)
    /public_html/wp-config.php(93)
    public_html/wp-admin/admin.php(31) . {main} thrown in /home/punkmmur/public_html/wp-includes/wp-db.php on line 1564

    Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/punkmmur/public_html/wp-includes/wp-db.php:1564 Stack trace: #0 /home/punkmmur/public_html/wp-includes/wp-db.php(592): wpdb->db_connect() #1 /home/punkmmur/public_html/wp-includes/load.php(409): wpdb->__construct(‘punkmmur_calyps…’, ‘password’, ‘xxxxxxx…’, ‘localhost’) #2 /home/punkmmur/public_html/wp-settings.php(106): require_wp_db() #3 /home/punkmmur/public_html/wp-config.php(93): require_once(‘/home/punkmmur/…’) #4 /home/punkmmur/public_html/wp-load.php(37): require_once(‘/home/punkmmur/…’) #5 /home/punkmmur/public_html/wp-admin/admin.php(31): require_once(‘/home/punkmmur/…’) #6 /home/punkmmur/public_html/wp-admin/index.php(10): require_once(‘/home/punkmmur/…’) #7 {main} thrown in /home/punkmmur/public_html/wp-includes/wp-db.php on line 1564

    The DB queries don’t work. But its all wordpress core files and they say wordpress is php 7.2-3 ready, where does this query come from?

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Forum Moderator & Support Team Volunteer

    The error is being detected in the core files but not caused by them. DO NOT EDIT CORE FILES.

    This may be a plugin or theme conflict. Please attempt to disable all plugins, and use one of the default (Twenty*) themes. If the problem goes away, enable them one by one to identify the source of your troubles.

    If you can install plugins, install “Health Check”: https://wordpress.org/plugins/health-check/ On the troubleshooting tab, you can click the button to disable all plugins and change the theme for you, while you’re still logged in, without affecting normal visitors to your site. You can then use its admin bar menu to turn on/off plugins and themes one at a time.

    See http://www.wpbeginner.com/plugins/how-to-deactivate-all-plugins-when-not-able-to-access-wp-admin/

    Dion

    (@diondesigns)

    There are only two ways that error can occur with WordPress 4.4+ and PHP 7+:

    1) the PHP mysqli extension is not available
    2) the WordPress WP_USE_EXT_MYSQL constant has been defined as TRUE

    Make sure the mysqli extension is installed in PHP. If so, then make sure you are not defining the WP_USE_EXT_MYSQL constant. (Check the wp-config.php file.)

    If you are using an aggressive cache such as Varnish, please note that the frontend can continue to work OK until the cache is cleared. If you are using an opcode cache such as Zend OPcache, make sure revalidation is immediate. Example:

    opcache.revalidate_freq = 0
    
    Thread Starter djusstattoo

    (@djusstattoo)

    @diondesigns @sterndata
    I was using wp super cache but i cleaned cache before starting and turned caching off. I turned health check troubleshooting mode on and desactivated all plugins and swithed to a default theme the twenty seventeen. After switching to php 7.3 with default theme and troubleshooting mode plugin desactivation, i got the same error:
    Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/punkmmur/public_html/wp-includes/wp-db.php:1564 Stack trace: #0 /home/punkmmur/public_html/wp-includes/wp-db.php(592): wpdb->db_connect() #1 /home/punkmmur/public_html/wp-includes/load.php(409): wpdb->__construct(‘punkmmur_calyps…’, ‘password’, ‘punkmmur_calyps…’, ‘localhost’) #2 /home/punkmmur/public_html/wp-settings.php(106): require_wp_db() #3 /home/punkmmur/public_html/wp-config.php(93): require_once(‘/home/punkmmur/…’) #4 /home/punkmmur/public_html/wp-load.php(37): require_once(‘/home/punkmmur/…’) #5 /home/punkmmur/public_html/wp-admin/admin.php(31): require_once(‘/home/punkmmur/…’) #6 /home/punkmmur/public_html/wp-admin/plugins.php(10): require_once(‘/home/punkmmur/…’) #7 {main} thrown in /home/punkmmur/public_html/wp-includes/wp-db.php on line 1564

    The wp-config.php has the WP_USE_EXT_MYSQL constant to “false”

    I noticed that MySQLi is not in php 7.3 just: mysqlnd and nd_mysqli. P

    Php 7.2 gave the same error but it has MySQLi. Cache is deleted and desactivated only plugin working is health check troubleshooting.

    • This reply was modified 2 years, 1 month ago by djusstattoo. Reason: minor name
    Thread Starter djusstattoo

    (@djusstattoo)

    And now i switched back to php 7.1 and the https://tatouagecalypso.com/wp-admin/plugins.php doesn’t work but i managed to switch to twenty seventeen theme.

    Thread Starter djusstattoo

    (@djusstattoo)

    @diondesigns @sterndata
    No php works desactivated all plugins and running twentyseventeen freshly restored, tried setting cachesetting to false in wp-config.php the WP_USE_EXT_MYSQL function is not defined. i renamed .htacces i renamed themes folders i renamed plugins folder to desactivate all i went to phpmyadmin in options table set to twentyseventeen theme and a:0:{} plugins nto desactivate all plugins. went back and forth in php versions and its really stuck in error mode. */wp-admin doesn’t work but website works but is displaying different themes on different pages.

    Thread Starter djusstattoo

    (@djusstattoo)

    @sterndata @diondesigns
    the problem was MySQLI php modules where not activated.
    We had to activate: nd_mysqls

    Plus caching was being a part of the problem even if plugin was desactivated. It would still load error message page as cached. Thats why reverting back to previous php versions would not work it would always serve the error message from cache.

    Even if /wp=admin didn’t work, the website was still ok and running probably caching was saving it.

    We had to access https://tatouagecalypso.com/wp-admin with url parameters to bypass caching bu adding https://tatouagecalypso.com/wp-admin/?d=asdd or just /?.

    So php modules have to be activated website now runs pnp 7.3 with nd_mysqls activated in php options in Cpanel.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Forum Moderator & Support Team Volunteer

    Your host should have enabled php-mysqlnd automagically when you enabled PHP 7.x. Good that you figured it out!

    Thread Starter djusstattoo

    (@djusstattoo)

    Oh … well… I’ll let them know thank you

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘MySQL connect requests causing fatal error on php 7.2 and 7.3 in wordpress files’ is closed to new replies.