php 数据库驱动程序 MySQLi 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13595579/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 05:44:25  来源:igfitidea点击:

Database Driver MySQLi Error

phpmysqldatabasemysqli

提问by Ivo

I am running Moodle test environment on Window Vista having PHP 5.2.10 and MySQL 5.1.36-Community. When I upgrade from Moodle 1.9.9 to 2.0, I am getting the following error.

我在具有 PHP 5.2.10 和 MySQL 5.1.36-Community 的 Window Vista 上运行 Moodle 测试环境。当我从 Moodle 1.9.9 升级到 2.0 时,出现以下错误。

Error: database driver problem detected

The site administrator should verify server configuration

PHP has not been properly configured with the MySQLi extension so that it can communicate with MySQL. Please check your php.ini file or recompile PHP. MySQLi extension is not available for PHP 4.

I also tried to change the dbtype='mysqli' in config.ini and still see same error.

我还尝试更改 config.ini 中的 dbtype='mysqli' 并且仍然看到相同的错误。

I would really appreciate if you can provide some suggestion to resolve this error.

如果您能提供一些解决此错误的建议,我将不胜感激。

Thank you in advance.

先感谢您。

回答by Ivo

I got this error as well some time ago and it took me quite a while to figure out a way how to solve that. Basically all you need to do is add an extension to your php envtheitroadment. The following solution fits to a Microsoft Windows Server 2003 running Apache and MySQL:

前段时间我也遇到了这个错误,我花了很长时间才找到解决这个问题的方法。基本上你需要做的就是为你的 php 环境添加一个扩展。以下解决方案适用于运行 Apache 和 MySQL 的 Microsoft Windows Server 2003:

  • Find out where your php folder is located on the server that moodle is running on. It is usually at c:\php.

  • Open php.ini. Within the file you will find ;extension=php_mysqli.dll. Delete the semicolon.

  • Save the file.

  • Restart Apache and go to your Moodle website.

  • 找出您的 php 文件夹在运行 Moodle 的服务器上的位置。它通常位于 c:\php。

  • 打开 php.ini。在该文件中,您将找到 ;extension=php_mysqli.dll。删除分号。

  • 保存文件。

  • 重新启动 Apache 并转到您的 Moodle 网站。

Here we go, you shold be fine from now on ;) hope this helped!!

我们走了,从现在开始你应该会没事的 ;) 希望这有帮助!!

回答by Mohit

For those looking for an answer for LINUX

对于那些正在寻找 LINUX 答案的人

uncomment

取消注释

;extension=mysqli.so

;扩展名=mysqli.so

in 'Dynamic Extensions' section in file 'php.ini' located in php folder ('/etc/php/php.ini' in my case)

在位于 php 文件夹中的文件“php.ini”中的“动态扩展”部分(在我的情况下为“/etc/php/php.ini”)

回答by Pratik Singhal

You need to install the following package php-mysqland then restart the Apache web server.

您需要安装以下软件包php-mysql,然后重新启动 Apache Web 服务器。

回答by Putnik

For my case: make sure the modules are a) installed b)enabled in php.ini

对于我的情况:确保模块 a) 已安装 b) 在 php.ini 中启用

回答by Rajesh Manickavel

You need to install the following package php-mysql and then restart the Apache web server.This is resolved my issue.

您需要安装以下软件包 php-mysql,然后重新启动 Apache Web 服务器。这解决了我的问题。

回答by Alireza815

I have the same problem. After enabling mysqli extension in php.ini by removing the ';' from the following line:

我也有同样的问题。通过删除“;”在 php.ini 中启用 mysqli 扩展后 从以下行:

;extension=mysqli

Nothing changed up to now. Then I saw a post on the net that said you have to install php-mysqlnd package. After installing it using following command the problem resolved:

到目前为止一切都没有改变。然后我在网上看到一个帖子说你必须安装php-mysqlnd包。使用以下命令安装后,问题解决:

sudo apt install php-mysqlnd