• vi_shire

    (@sabattinivirna)


    Hello,

    in the last days I had a white page problem with WordPress, so I controlled the last plugins: either if I disabled all of them, the website was still blank.

    So I tried to update WordPress to the latest version and the only plugin not totally compatible was Divi Builder 2.0.
    So I updated it to 2.0.7, but while the plugin was updating, I had this line in my Dashboard:

    Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/asdgrupp/public_html/wp-includes/wp-db.php on line 1570.

    That’s the line 1570 in my wp-db.php file:

    if ( WP_DEBUG ) {
    $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
    } else {
    $this->dbh = @mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
    }

    I’ve already contact the plugin developer too, but I’m not very practised in mysql and I can’t understand if this problem is related to my last WordPress update or plugin.

    The website works well, but I’ve tried to hide the warning error with:

    <?php
    error_reporting(E_ALL ^ E_DEPRECATED);

    on the top of my wp-db.php file, but it doesn’t work.

    My PHP version is 5.6.30 and mysqli is supported by my hosting.

    Sorry for my english and thank you for the help.

Viewing 8 replies - 1 through 8 (of 8 total)
  • What version of WordPress are you using, and what PHP version is currently being used? This error usually pop ups on the following combination:

    • A older version of WordPress
    • PHP 7 is active on your hosting

    I’m not exactly sure on the WordPress version that’s considered too old to use with PHP 7, but updating to the most recent WordPress version usually fixes this.

    Thread Starter vi_shire

    (@sabattinivirna)

    Hi!

    I’m using the last version of WordPress (4.7.5) and PHP is active on my hosting.
    This error came out after the last update of WordPress and the builder plugin of my theme (I’ve already contact the developer, I’m waiting for the answer).

    Now I hide the warning on my site put on false the function WP-DEBUG, but I don’t know if “hide” is a real solution…

    Hiding errors is never the solution ??

    If you are using the latest WordPress version this problem is likely to be caused by a plugin or your theme. So probably you’d best wait for an answer from the developer.

    Thread Starter vi_shire

    (@sabattinivirna)

    Okay, thank you! ??

    When I’ll have an answer from the developer, I copy and paste here, maybe someone else is in trouble too.

    Thank you.

    [05-Jul-2017 11:10:21 UTC] PHP Warning: mysqli_real_connect(): (HY000/2002): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2) in /home/…/wp-includes/wp-db.php on line 1538
    [05-Jul-2017 11:10:21 UTC] PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/…/wp-includes/wp-db.php on line 1568
    [05-Jul-2017 11:10:21 UTC] PHP Warning: mysql_connect(): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2) in /home/…/wp-includes/wp-db.php on line 1568

    WordPress 4.8
    Apache 2.2.32
    PHP 5.4.43
    MySQL 5.6.32

    After enabling WP_DEBUG.

    Same issue at Berdych – what’s the workaround for this? Or am I missing something?

    WordPress version 4.9.1 wp-includes/wp-db.php has msql_connect in lines 1579 and 1571

    The msql_connect throws fatal errors in PHP 7. Why is this deprecated extension still being used in this core file?

    Changing to mysqli_connect didn’t work. The quick workaround is to revert to PHP 5.6, if you can.

    I am seeing the same error. This occurred on WP 4.9.1 (latest at this time).

    Most versions of PHP will throw the Deprecated message. Some will simply give a fatal error as Malae reported. PHP 5.5.38 is in use on my site.

    [03-Jan-2018 13:52:55 UTC] PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysql or PDO instead in /var/www/vhosts/missionnext.org/wordpress/wp-includes/wp-db.php on line 1569

    A problem is that this constantly writes in a log file, taking both CPU and storage resource needlessly.

    • This reply was modified 6 years, 11 months ago by nelsonmct. Reason: Minor edits
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘“The mysql extension is deprecated” after update’ is closed to new replies.