• We have WP installed on a Windows Server 2012 running it on IIS 8.

    We updated WP to 5.1.1, then updated PHP from version 5.6.3 to 7.2.18 following the instructions listed on https://www.php.net/manual/en/install.windows.manual.php, I installed “php-7.2.18-nts-Win32-VC15-x64” and we’re getting this error:

    Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\inetpub\wwwroot\wp-includes\wp-db.php:1645 Stack trace: #0 C:\inetpub\wwwroot\wp-includes\wp-db.php(639): wpdb->db_connect() #1 C:\inetpub\wwwroot\wp-includes\load.php(435): wpdb->__construct(‘(removed for security?)’, ‘(removed for security?)’, ‘(removed for security?)’, ‘(removed for security?)’) #2 C:\inetpub\wwwroot\wp-settings.php(109): require_wp_db() #3 C:\inetpub\wwwroot\wp-config.php(99): require_once(‘C:\\inetpub\\wwwr…’) #4 C:\inetpub\wwwroot\wp-load.php(37): require_once(‘C:\\inetpub\\wwwr…’) #5 C:\inetpub\wwwroot\wp-blog-header.php(13): require_once(‘C:\\inetpub\\wwwr…’) #6 C:\inetpub\wwwroot\index.php(17): require(‘C:\\inetpub\\wwwr…’) #7 {main} thrown in C:\inetpub\wwwroot\wp-includes\wp-db.php on line 1645

    I don’t know what to do at this point.

Viewing 8 replies - 1 through 8 (of 8 total)
  • the mysql library is deprecated from 5.5.0 and removed from 7.0.0 you simply need to download the mysqli library
    https://www.php.net/manual/en/mysqli.installation.php

    Thread Starter grojas1980

    (@grojas1980)

    I downloaded and installed MySQL Server 8, and we’re still getting the same error.

    On Windows, for PHP versions 5.3 and newer, the mysqli extension is enabled and uses the MySQL Native Driver by default. This means you don’t need to worry about configuring access to libmysql.dll.
    https://www.php.net/manual/en/mysqli.installation.php

    Wordpress first looks for mysqli and if it doesn’t find it, use mysql.
    The php library is not the mysql server.

    If you have also entered Workbench try creating a simple php code … like this guide that uses mysqli.
    Create another database with content then do the sql that generates the php code with the mysql library
    as the first line
    Use my_fantasydatabase; https://dev.mysql.com/doc/workbench/en/wb-generating-php.html

    If you are using MySQL versions 4.1.3 or later it is strongly recommended that you use this extension.

    As well as the object-oriented interface the extension also provides a procedural interface.

    The mysqli extension is built using the PHP extension framework, its source code is located in the directory ext/mysqli.

    https://dev.mysql.com/doc/apis-php/en/apis-php-mysqli.overview.html

    Thread Starter grojas1980

    (@grojas1980)

    Here are the steps we took:

    – The server has MySQL 5.1 and 5.7, the database is in the 5.1 data folder, using workbench I made an export of the database and data.

    – Updated Workbench(x64) and the Connectors/NET(x86) to 8.0.16

    – Installed MySQL Server 8.0.16(x64). Configured it for localhost:3307. Also told it not to use encryption.

    – Restored the database into MySQL Server 8.0.16.

    – Opened wp-config.php and edited this line:

    From: /** MySQL hostname */
    define(‘DB_HOST’, ‘localhost’);

    To: /** MySQL hostname */
    define(‘DB_HOST’, ‘localhost:3307’);

    – I then updated PHP to 7.2.18-NTS (since we’re running it on a windows machine using IIS 8).

    – Restarted Application Pool.

    Site throws same error. I am new to PHP and MySQL. What am I doing wrong?

    can you create a file called test.php?

    <?php
    if(!function_exists('mysql_connect')){
    echo 'absent or non-enabled mysql library';
    }
    if(!function_exists('mysqli_connect'))(
    echo 'absent or non-enabled mysqli library';
    }
    ?>

    now you just need to call it from a browser https://www.yuordomain.com/test.php
    Check if the mysqli library exists in the path ext/mysqli

    Thread Starter grojas1980

    (@grojas1980)

    I get this error:

    Parse error: syntax error, unexpected ‘echo’ (T_ECHO) in C:\inetpub\wwwroot\wp-admin\test.php on line 6….

    here’s the code I ran when updating PHP, maybe this is wrong:

    @echo off
    
        REM download .ZIP file of PHP build from https://windows.php.net/downloads/
        REM
        REM path to directory you decompressed PHP .ZIP file into
    set phpdir=c:\php
    set phppath=php-7.2.18-nts-Win32-VC15-x64
    
    REM Clear current PHP handlers
    %windir%\system32\inetsrv\appcmd clear config /section:system.webServer/fastCGI
    %windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /-[name='PHP_via_FastCGI']
    
    REM Set up the PHP handler
    %windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath='%phpdir%\%phppath%\php-cgi.exe']
    %windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='%phpdir%\%phppath%\php-cgi.exe',resourceType='Unspecified']
    %windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /accessPolicy:Read,Script
    
    REM Configure FastCGI Variables
    %windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /[fullPath='%phpdir%\%phppath%\php-cgi.exe'].instanceMaxRequests:10000
    %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='%phpdir%\%phppath%\php-cgi.exe'].environmentVariables.[name='PHP_FCGI_MAX_REQUESTS',value='10000']"
    %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='%phpdir%\%phppath%\php-cgi.exe'].environmentVariables.[name='PHPRC',value='%phpdir%\%phppath%\php.ini']"
    Thread Starter grojas1980

    (@grojas1980)

    I looked inside the ext folder and found a file called php_mysqli.dll, is that the one?

    Thread Starter grojas1980

    (@grojas1980)

    Ok. I got it working now.

    When I extracted the zip file it has 2 ini files, php.ini-development and php.ini-production. after removing -production and going inside the ini file and make sure it enabled MySQLi it worked.

    Thanks for the help

    • This reply was modified 5 years, 10 months ago by grojas1980.
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Updated PHP from 5.6.3 to 7.2.18 into WP 5.1.1’ is closed to new replies.