Fatal error: Call to undefined function mysqli_connect()的解决方案

我在用mysqli_connect连接MYSQL数据库时,出现致命错误提示:Fatal error: Call to undefined function mysqli_connect()的提示,经狗狗发现解决办法其实很简单:只要在PHP。INI中将;extension=php_mysqli.dll前面的注释去掉保存即可。依据如下:

For mysqli, the proper way to initiate a MySQL connection is to use one of:

$link = mysqli_init();
mysqli_real_connect($link, $host, $user, $pass, $db);


$link = mysqli_connect($host, $user, $pass);


$link = new mysqli($host, $user, $pass, $db);

(I prefer the last one.)

In any case, you must have one of the lines


uncommented in your php.ini file (by removing the leading semicolon), depending on which library you want to use. (Looks like you've got this part figured out.)

Then you should copy either libmysql.dll or libmysqli.dll from your PHP installation directory (usually C:\php on a windows system) to your system directory, depending on which MySQL library you want to use. On Windows 2000 this would be the C:\WINNT\system32 directory.

Restart Apache and check the output of phpinfo(). Under Configuration, you should see a table labeled "mysql" or "mysqli".