2 天了,我一直在努力解决这个问题,但不幸的是没有结果.让我告诉你我关于这个问题的故事.我在网站上构建了一个应用程序,该应用程序处理评论.但是,我试图把它放在另一个站点上,我复制了旧站点的 php 文件和 sql 文件,并将它们移动到新站点(它们位于不同的 FTP 服务器上).当我尝试从应用程序转到页面时,收到此致命错误:
For 2 days now I'm trying to solve this, but unfortunately no result. Let me tell you my story about the problem. I've bulid an application on a site, and the application deals with the reviews. But, I'm trying to put it on another site, and I copyed the php files, the sql file from the old site, and moved them to the new site (they are on different FTP servers). When I'm trying to go to the pages from the application, I receive this FATAL ERROR:
致命错误:调用未定义的函数mysqli_connect()
Fatal error: Call to undefined function mysqli_connect()
我写的连接数据库的代码是这样的(带有隐藏的凭据):
The code that I wrote to connect to the database is this (with hidden credentials):
$con = mysqli_connect("","*the_name*","*the_pass*","*the_database*");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
为什么我会收到错误消息?它在旧服务器上工作,我认为代码不是问题,因为它在本地主机上工作,而在新服务器上却没有.有人可以帮我吗?
Why do I get the error? It works on the old server, and the code I think it's not the problem, because it works on localhost, and on the new server it doesn't. Can anyone help me?
简单操作
sudo apt install php-mysqli
它完美运行,并且与版本无关
It works perfectly and it is version independent
这篇关于致命错误:调用未定义的函数 mysqli_connect()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!