Fatal error: Class 'MySQLi' not found怎么解决

在使用mysqli函数库时有可能会遇到该问题,我来说一下在我的电脑(ubuntu17.01,PHP7.1)上我的问题的解决办法。

首先运行含有此段代码的PHP脚本:

<?php
if(!function_exists('mysqli_init')&&!extension_loaded('mysqli')){
    echo 'We don\'t have mysqli!!!';
} else {
    echo 'Phew we have it!';
}
?>

如果显示没有mysqli,就进行安装:

sudo apt-get install php-mysqlnd

然后重启apache服务器:

/etc/init.d/apache2 restart

猜你喜欢

转载自blog.csdn.net/jlu16/article/details/79504784