MySQLi not found error

drewwyatt picture drewwyatt · Feb 18, 2014 · Viewed 20k times · Source

I just deployed my website to a staging environment and am getting the following error:

Fatal error: Class 'mysqli' not found in D:\ClientSites\baileyboiler.com\www\new\php\db.php on line 11

At first I assumed that MySQLI was simply not installed, but running a phpinfo() reveals the following:

enter image description here

To me it looks like MySQLI is installed (though I could be reading this wrong). What should I do?

Code

class DB
{
    public static function GetConnection()
    {
        return new mysqli(DBHOST, DBUSER, DBPASSWORD, DEFAULTDATABASE);
    }
}

(line 11 is the return new mysql(...);)

Update

I added extension=php_mysqli.dll to my php.ini located at /Windows/php.ini (according to phpinfo(), this is the one being loaded):

Loaded Configuration File   C:\WINDOWS\php.ini

But the error persists. I know that mysqli.dll exists at C:\php\ext - because I can see the file. What now?

Answer

Christian Mark picture Christian Mark · Sep 10, 2014

I got the error corrected by enabling/editing the following config in php.ini:

1st (uncomment and add config):

include_path = "C:\php\includes"

2nd (uncomment):

extension_dir = "ext"

3rd (uncomment and edit config):

extension=D:/PHP/ext/php_mysql.dll
extension=D:/PHP/ext/php_mysqli.dll