Support » Localhost Installs » PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in

  • Resolved sbsmain

    (@sbsmain)


    I installed php 7.2 and have since gotten this error:
    PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\inetpub\wwwroot\wp-includes\wp-db.php:1564

    I’ve googled it and tried several things, but nothing seems to work. I’m new to this, so, I could use some help. If I reinstall WordPress, what folders would I need to replace to get my website going again?

    Mike in SC

Viewing 15 replies - 1 through 15 (of 17 total)
  • WordPress itself supports PHP 7.2 (at least I assume you are using a fairly recent version of WP). Make sure your environment has either MySQL 5.6+ or MariaDB 10+.

    Dion

    (@diondesigns)

    Please check your wp-config.php file for the following line:

    define('WP_USE_EXT_MYSQL', true);

    If you find it, delete the line. Your problem should be fixed.

    If you still have the problem, then you incorrectly installed PHP 7.2.x. The error you reported is not possible if you are using PHP 7.2.x and the above line isn’t in wp-config.php.

    Installing Mariadb 10.3 fixed this.

    I can now view my webpage in localhost and access it from other computers on my domain, but the graphics don’t disply on the other computers. The problem is my path is pointed to localhost. So, I’m currently trying to login to the wordpress dashboard, but it doesn’t give me that option. Any ideas?

    • This reply was modified 2 years, 3 months ago by sbsmain.

    I’ll mark this one resolved and post the new issue.

    Francesco

    (@fcolombo)

    For what is worth, I encountered the same error and the issue was solved by enabling the nd_mysqli extension in the PHP 7 configuration, and disabling the mysqli one.

    magornitho

    (@magornitho)

    Thanks Francesco! I did as you said and the error was solved (enabled nd_mysqli, the mysqli was already disabled).
    I was using PHP 7 since months, so I don’t know why the error happened (today) in the first place?

    Francesco

    (@fcolombo)

    Glad it helped!

    I encountered the error when I upgraded to PHP 7 while having the W3 Total Cache “Database cache” enabled.

    Maybe you’ve played around with W3TC today?

    See for reference: https://wordpress.org/support/topic/database-cache-causing-503-errors-when-upgrading-to-php-7/

    Thanks Francesco! This fixed the issue for me as well. I had a caching plugin installed when updating WP.

    Hi

    I’m creating my first site and came upon the error below.
    i had created a first page on my domain and i was stuck somewhere unable to edit it, so i deleted all my files on that and started a new website on the same domain.
    The problem is, the new website is not accessible.
    i have not downloaded anything else apart from wordpress so i dont think the error i have is related to the php download described above

    I’m seeing lots of delete.wpm…stuff in here and i’m not sure how to proceed

    The error is:

    PHP Fatal error: Uncaught Error: Call to undefined function get_transient() in /home/upku9mvvkvf0/public_html/deleteme.wpmfgw.php:16
    Stack trace:
    #0 {main}
    thrown in /home/upku9mvvkvf0/public_html/deleteme.wpmfgw.php on line 16
    [14-Apr-2019 04:29:43 UTC] PHP Fatal error: Uncaught Error: Call to undefined function get_transient() in /home/upku9mvvkvf0/public_html/deleteme.wpkq1x.php:16
    Stack trace:
    #0 {main}
    thrown in /home/upku9mvvkvf0/public_html/deleteme.wpkq1x.php on line 16
    [14-Apr-2019 04:29:43 UTC] PHP Fatal error: Uncaught Error: Call to undefined function get_transient() in /home/upku9mvvkvf0/public_html/deleteme.wppsmo.php:16
    Stack trace:
    #0 {main}
    thrown in /home/upku9mvvkvf0/public_html/deleteme.wppsmo.php on line 16

    please assist me to solve this.
    Kind Regards

    UPDATE
    i just realized that i signed up to linux hosting with cpanel (on godaddy)….while my pc is on windows
    oh well!!!!
    let me now try to resolve the new problem :/

    • This reply was modified 1 year, 7 months ago by fawzia.
    • This reply was modified 1 year, 7 months ago by fawzia.

    Francesco’s trick worked form me. I am now running WP 5.2.3 on PHP 7.3 on cPanel.

    I am throwing this error. Where exactly can I toggle this setting to change mysqli to nd_mysqli?

    I face a similar problem. And I was able to solve it by following Francesco‘s instruction.
    Currently, I using PHP 7.3 version and WordPress latest version. Just enabled the extension nd_mysqli.
    I instantly solved the problem and My WordPress site now working good.

    Thanks Francesco‘s and other for help.

    Can you tell me how can I enable the nd_mysqli extension please?

    Thank you.

    If anyone else is having this problem while doing an initial install of wordpress 5.4 on a php 7.x on windows no less, try uncommenting the extension=mysqli line in your php.ini file. That eventually got me there.

    Please help with this same issue, I have a Apache and PHP 7.4.5 running on a Windows 10 machine. I was still trying to install wordpress when I encountered an error

    There has been a critical error on your website.

    Learn more about debugging in WordPress.

    I enabled debugging and entered the db details on the wp-config files manually but then I started getting this error.

    Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\Apache24\htdocs\clickmedia\wp-includes\wp-db.php:1658 Stack trace: #0 C:\Apache24\htdocs\clickmedia\wp-includes\wp-db.php(631): wpdb->db_connect() #1 C:\Apache24\htdocs\clickmedia\wp-includes\load.php(426): wpdb->__construct(‘admin’, ‘081447Addax’, ‘clickmedia’, ‘127.0.0.1’) #2 C:\Apache24\htdocs\clickmedia\wp-settings.php(126): require_wp_db() #3 C:\Apache24\htdocs\clickmedia\wp-config.php(90): require_once(‘C:\\Apache24\\htd…’) #4 C:\Apache24\htdocs\clickmedia\wp-load.php(37): require_once(‘C:\\Apache24\\htd…’) #5 C:\Apache24\htdocs\clickmedia\wp-blog-header.php(13): require_once(‘C:\\Apache24\\htd…’) #6 C:\Apache24\htdocs\clickmedia\index.php(17): require(‘C:\\Apache24\\htd…’) #7 {main} thrown in C:\Apache24\htdocs\clickmedia\wp-includes\wp-db.php on line 1658

    I have tried to follow @fcolombo’s suggestion but
    1. I dont have the PHP configuration utility you refer to. So I edited the PHP.ini file
    2. I can’t find nd_mysql as stated

    I only found this line which I uncommented.

    extension=mysqli

    there is also a this line
    [mysqlnd]
    with other configurations for mysqlnd, could this be the same as nd_mysql?

    Your help would be much appreciated. Stuck trying to to sort this out for hours

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in’ is closed to new replies.