問(wèn)題描述
2 天了,我一直在努力解決這個(gè)問(wèn)題,但不幸的是沒(méi)有結(jié)果.讓我告訴你我關(guān)于這個(gè)問(wèn)題的故事.我在網(wǎng)站上構(gòu)建了一個(gè)應(yīng)用程序,該應(yīng)用程序處理評(píng)論.但是,我試圖把它放在另一個(gè)站點(diǎn)上,我復(fù)制了舊站點(diǎn)的 php 文件和 sql 文件,并將它們移動(dòng)到新站點(diǎn)(它們位于不同的 FTP 服務(wù)器上).當(dāng)我嘗試從應(yīng)用程序轉(zhuǎn)到頁(yè)面時(shí),收到此致命錯(cuò)誤:
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:
致命錯(cuò)誤:調(diào)用未定義的函數(shù)mysqli_connect()
Fatal error: Call to undefined function mysqli_connect()
我寫的連接數(shù)據(jù)庫(kù)的代碼是這樣的(帶有隱藏的憑據(jù)):
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();
}
為什么我會(huì)收到錯(cuò)誤消息?它在舊服務(wù)器上工作,我認(rèn)為代碼不是問(wèn)題,因?yàn)樗诒镜刂鳈C(jī)上工作,而在新服務(wù)器上卻沒(méi)有.有人可以幫我嗎?
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?
推薦答案
簡(jiǎn)單操作
sudo apt install php-mysqli
它完美運(yùn)行,并且與版本無(wú)關(guān)
It works perfectly and it is version independent
這篇關(guān)于致命錯(cuò)誤:調(diào)用未定義的函數(shù) mysqli_connect()的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!