未捕获的错误:连接到数据库时调用未定义的函数mysqli_connect() [英] Uncaught Error: Call to undefined function mysqli_connect() when connecting to the database
本文介绍了未捕获的错误:连接到数据库时调用未定义的函数mysqli_connect()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在PHP 7.0和PHP 7.1上尝试使用mysqli连接到数据库时出现错误
I get an error when trying to connect to my database with mysqli on PHP 7.0 and PHP 7.1
PHP致命错误:未捕获错误:调用/home/mywebsite/public_html/connection.php:7中未定义的函数mysqli_connect()
PHP Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /home/mywebsite/public_html/connection.php:7
$conn = mysqli_connect($DBhost,$DBuser,$DBpass,$DBname);
推荐答案
-
首先检查是否启用了mysqli:
phpinfo()
您的服务器上未安装mysqli PHP扩展.与您的服务器管理员联系.
The mysqli PHP extension is not installed on your server. Contact to your server administrator.
OR
- 如果您自己托管服务器,则在 php.ini 文件中,删除扩展名 extension = php_mysqli.dll 前面的分号.
- If you host the server yourself, in the php.ini file remove the semicolon in front of the extension extension=php_mysqli.dll.
希望,这对您有帮助
这篇关于未捕获的错误:连接到数据库时调用未定义的函数mysqli_connect()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文