Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
275 views
in Technique[技术] by (71.8m points)

php - MySQLi not found error

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

Fatal error: Class 'mysqli' not found in D:ClientSitesaileyboiler.comwww
ewphpdb.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:WINDOWSphp.ini

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

1st (uncomment and add config):

include_path = "C:phpincludes"

2nd (uncomment):

extension_dir = "ext"

3rd (uncomment and edit config):

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...