Codeigniter:对未定义函数 mysqli_init() 的致命错误调用 [英] Codeigniter: fatal error call to undefined function mysqli_init()

查看:46
本文介绍了Codeigniter:对未定义函数 mysqli_init() 的致命错误调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚更换了服务器并遇到以下错误:

I just changed my server and experience these errors below:

Fatal error: Call to undefined function mysqli_init() in /home/blacktwitter/public_html/system/database/drivers/mysqli/mysqli_driver.php on line 126
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/blacktwitter/public_html/system/database/drivers/mysqli/mysqli_driver.php:126)

Filename: core/Common.php

Line Number: 564

Backtrace:

A PHP Error was encountered

Severity: Error

Message: Call to undefined function mysqli_init()

Filename: mysqli/mysqli_driver.php

Line Number: 126

Backtrace:

网站在 Codeigniter 中.它可以很好地在一台服务器上运行,也可以在本地机器上运行.但是当我在新服务器上上传该网站时,我遇到了这些错误.当然,我更改了数据库连接、base_url() 等重要参数.

Website is in Codeigniter. It works on one server very well and on the local machine too. But when I upload that website at the new server I have that errors. Of course I changed important parameters like database connection, base_url() etc.

我怀疑数据库,但我创建了一个新的数据库和用户等,并更改了连接信息.

I was suspicious about database, but I have created a new database and user etc. and changed connection info.

为什么会这样?了解它是服务器上的错误还是网站上的错误会很有帮助.此外,当我用一些测试代码创建一些 index.html 时,一切都很好.

Why does this happen? It will be helpful to know if it is a bug at the server or at the website. Also when I create some index.html with some test code everything is fine.

推荐答案

这不是您的应用程序中的错误,它只是缺少驱动程序,因此,您有几个选择...

It is not a bug in your application, it is just a missing driver, so, you have couple of options...

转到您的 php init 并取消注释以下内容:

Go to your php init and uncomment the following:

extension=php_mysqli.dll

如果没有,请尝试在您的服务器上安装它,这取决于您的发行版.

If not, try installing it at your server, it varies depending on your distribution.

尝试安装 php5-mysqlnd

如果您不能通过托管限制来做到这一点,那么只需移至 mysql 驱动程序(无需更改 CodeIgniter 中的其他配置或查询或其他任何内容...)

If you cannot do it by hosting restrictions then just move to mysql driver (wont need to change other configurations or queries in CodeIgniter or anything else...)

像这样(在您的配置文件中)

like this (at your config file)

$db['default']['dbdriver'] = 'mysql'; (you might have mysqli now)

这篇关于Codeigniter:对未定义函数 mysqli_init() 的致命错误调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆