• I am trying to install WordPress on localhost on Windows 10 for testing before upload it to my hosting service. I first tried to use XAMPP to install everything, but had to remove it. Then, I installed Apache 2.4, MySQL 8, and PHP 7.4 individually.

    When I tried to run install.php I get the following message:
    “There has been a critical error on this website.”

    After investigation, it seems like wp-db.php is using mysql_connect() instead of the newer mysqli extensions.

    Apache indicates that the proper modules are installed, including php7_module.

    Here’s where the install.php seems to bomb:

    Stack trace:
    #0 C:\Apache24\htdocs\wptest\wp-includes\wp-db.php(724): wpdb->db_connect()
    #1 C:\Apache24\htdocs\wptest\wp-includes\load.php(561): wpdb->__construct('deleted', 'deleted', 'wptest', 'localhost')
    #2 C:\Apache24\htdocs\wptest\wp-settings.php(124): require_wp_db()
    #3 C:\Apache24\htdocs\wptest\wp-config.php(101): require_once('C:\\Apache24\\htd...')
    #4 C:\Apache24\htdocs\wptest\wp-load.php(50): require_once('C:\\Apache24\\htd...')
    #5 C:\Apache24\htdocs\wptest\wp-admin\install.php(36): require_once('C:\\Apache24\\htd...')
    #6 {main}
      thrown in C:\Apache24\htdocs\wptest\wp-includes\wp-db.php on line 1785

    ///

    I have installed WordPress 5.9, which should have the proper extensions, or so I believe. Regardless, it seems like my installation wants to use mysql_connect() instead of mysqli .

    Anyway, I am totally new to WordPress, and so it could be something quite simple. But regardless, I am stumped.

    Any help would be appreciated.

    Bob Frankenhoff

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

Viewing 15 replies - 1 through 15 (of 20 total)
  • wp-includes\load.php(561): wpdb->__construct('deleted', 'deleted', 'wptest', 'localhost')

    Can you confirm that your DB username and password values are deleted?

    Thread Starter rfrankenhoff

    (@rfrankenhoff)

    Yes,

    I deleted them for security reasons.

    Bob F

    Thread Starter rfrankenhoff

    (@rfrankenhoff)

    I deleted them before I sent them to you.

    Bob F

    Ok, I understand that you replaced the username and password with deleted in the error message.

    Can you try 127.0.0.1 as the hostname instead of localhost and see if that works for you?

    Thread Starter rfrankenhoff

    (@rfrankenhoff)

    Same result:

    And the error log again:
    [11-Mar-2022 18:43:08 UTC] PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\Apache24\htdocs\wptest\wp-includes\wp-db.php:1785
    Stack trace:
    #0 C:\Apache24\htdocs\wptest\wp-includes\wp-db.php(724): wpdb->db_connect()
    #1 C:\Apache24\htdocs\wptest\wp-includes\load.php(561): wpdb->__construct(‘deleted again’, ‘deleted again’, ‘wptest’, ‘localhost’)
    #2 C:\Apache24\htdocs\wptest\wp-settings.php(124): require_wp_db()
    #3 C:\Apache24\htdocs\wptest\wp-config.php(101): require_once(‘C:\\Apache24\\htd…’)
    #4 C:\Apache24\htdocs\wptest\wp-load.php(50): require_once(‘C:\\Apache24\\htd…’)
    #5 C:\Apache24\htdocs\wptest\wp-admin\install.php(36): require_once(‘C:\\Apache24\\htd…’)
    #6 {main}
    thrown in C:\Apache24\htdocs\wptest\wp-includes\wp-db.php on line 1785

    Updated: Please check your php.ini and make sure mysqli extensions are loading.

    • This reply was modified 2 years, 8 months ago by Vijay Hardaha.
    Thread Starter rfrankenhoff

    (@rfrankenhoff)

    Sorry,

    I only used 127.0.0.1 on my browser. Here it is again with changes in wp-config.php:

    Stack trace:
    #0 C:\Apache24\htdocs\wptest\wp-includes\wp-db.php(724): wpdb->db_connect()
    #1 C:\Apache24\htdocs\wptest\wp-includes\load.php(561): wpdb->__construct('del', 'del', 'wptest', '127.0.0.1')
    #2 C:\Apache24\htdocs\wptest\wp-settings.php(124): require_wp_db()
    #3 C:\Apache24\htdocs\wptest\wp-config.php(101): require_once('C:\\Apache24\\htd...')
    #4 C:\Apache24\htdocs\wptest\wp-load.php(50): require_once('C:\\Apache24\\htd...')
    #5 C:\Apache24\htdocs\wptest\wp-admin\install.php(36): require_once('C:\\Apache24\\htd...')
    #6 {main}
      thrown in C:\Apache24\htdocs\wptest\wp-includes\wp-db.php on line 1785

    Php.ini is a big file. What exactly am I looking for?

    Bob F

    Look for lines

    extension_dir="ext"
    extension=mysql
    extension=mysqli

    To know, you can also use https://localwp.com/ if you’re not comfortable setting & fixing all these environment things manually.

    Thread Starter rfrankenhoff

    (@rfrankenhoff)

    Well, I uncommented

    extension_dir = “ext”
    extension=mysql
    extension=mysqli

    Still doesn’t work.

    Do I need to re-start httpd.exe? (I did.)

    You also mentioned absolute paths to these modules. I’m sure I have added additional folders (e.g. wptest/).

    However, you also mentioned https://localwp.com/ .

    I have worked with the environment in Windows 10, but it is new to me and for some things I prefer Linux.

    Bob F

    Thread Starter rfrankenhoff

    (@rfrankenhoff)

    Also, any concerns regarding caching?

    Bob F

    Dion

    (@diondesigns)

    It sounds like you’re not loading the PHP mysqlnd extension. Without mysqlnd, the mysqli extension will not recognize the new authentication plugins used by MySQL8.

    Thread Starter rfrankenhoff

    (@rfrankenhoff)

    Regarding mysqlnd, I do not seem to see a file with that name anywhere, e.g. php_mysqlmd.dll or similar. Is that a part of the PHP extensions–should it be in the ext directory of PHP? If not, where might I find it?

    Thanks,

    Bob F

    Thread Starter rfrankenhoff

    (@rfrankenhoff)

    Also, I did install MySQL myself. I tried setting up a server with XAMPP, but nothing worked correctly other than MySQL. Perhaps I did not install MySQL with the correct options??? I did remove it and re-install it.

    Bob F

    Dion

    (@diondesigns)

    Sorry about that…I completely missed the Windows 10 statement in your first post. Windows builds of PHP from windows.php.net have mysqlnd compiled into the php_mysqli.dll file.

    Windows builds of PHP do not support named pipes, so make sure you configure MySQL to use TCP (skip-networking and enable-named-pipe must be disabled!), and then use 127.0.0.1 for the hostname. You might also want to read this:

    https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Error installing WordPress’ is closed to new replies.