問題描述
我剛剛將我的網(wǎng)站部署到暫存環(huán)境,但出現(xiàn)以下錯(cuò)誤:
I just deployed my website to a staging environment and am getting the following error:
Fatal error: Class 'mysqli' not found in D:ClientSitesaileyboiler.comwww
ewphpdb.php on line 11
起初我認(rèn)為 MySQLI 沒有安裝,但運(yùn)行 phpinfo()
會(huì)顯示以下內(nèi)容:
At first I assumed that MySQLI was simply not installed, but running a phpinfo()
reveals the following:
對(duì)我來說,它看起來像是安裝了 MySQLI(雖然我可能讀錯(cuò)了).我該怎么辦?
To me it looks like MySQLI is installed (though I could be reading this wrong). What should I do?
代碼
class DB
{
public static function GetConnection()
{
return new mysqli(DBHOST, DBUSER, DBPASSWORD, DEFAULTDATABASE);
}
}
(第11行是return new mysql(...);
)
更新
我將 extension=php_mysqli.dll
添加到位于 /Windows/php.ini
的 php.ini(根據(jù) phpinfo()
,這是正在加載的):
I added extension=php_mysqli.dll
to my php.ini located at /Windows/php.ini
(according to phpinfo()
, this is the one being loaded):
Loaded Configuration File C:WINDOWSphp.ini
但是錯(cuò)誤仍然存??在.我知道 mysqli.dll 存在于 C:phpext
- 因?yàn)槲铱梢钥吹皆撐募?現(xiàn)在怎么辦?
But the error persists. I know that mysqli.dll exists at C:phpext
- because I can see the file. What now?
推薦答案
我通過在 php.ini
中啟用/編輯以下配置來糾正錯(cuò)誤:
I got the error corrected by enabling/editing the following config in php.ini
:
第一個(gè)(取消注釋并添加配置):
1st (uncomment and add config):
include_path = "C:phpincludes"
第二(取消注釋):
extension_dir = "ext"
第三(取消注釋和編輯配置):
3rd (uncomment and edit config):
extension=D:/PHP/ext/php_mysql.dll
extension=D:/PHP/ext/php_mysqli.dll
這篇關(guān)于MySQLi未找到錯(cuò)誤的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!