MySQL 缺少 mysqli 扩展。请检查您的 PHP 配置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10646655/
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
The mysqli extension is missing. Please check your PHP configuration
提问by Wesley
I have looked through all of the forums that I could find relevant to this question and my problem yet nothing works. I have apache2.2 with php5, phpMyAdmin, and MySQL. I have uncommented the extension, I have checked my phpinfo()
and mysqli does not come up. My config directory is where it should be and it still will not load.
我已经浏览了所有可以找到与此问题和我的问题相关的论坛,但没有任何效果。我有带有 php5、phpMyAdmin 和 MySQL 的 apache2.2。我取消了扩展名的注释,我检查了我的phpinfo()
和 mysqli 没有出现。我的配置目录是它应该在的地方,但它仍然无法加载。
回答by AAGREDA
- Find out which php.ini is used.
In file php.ini this line:
extension=mysqli
Replace by:
extension="C:\php\ext\php_mysqli.dll"
- Restart apache
- 找出使用的是哪个 php.ini。
在文件 php.ini 中这一行:
extension=mysqli
替换为:
extension="C:\php\ext\php_mysqli.dll"
- 重启apache
回答by sradforth
I know this is a while ago but I encountered this and followed the other answers here but to no avail, I found the solution via this question (Stackoverflow Question)
我知道这是前一段时间,但我遇到了这个问题并遵循了这里的其他答案但无济于事,我通过这个问题找到了解决方案(Stackoverflow 问题)
Essentially just needed to edit the php.ini file (mine was found at c:\xampp\php\php.ini) and uncomment these lines...
基本上只需要编辑 php.ini 文件(我的文件位于 c:\xampp\php\php.ini)并取消注释这些行...
;extension=php_mysql.dll
;extension=php_mysqli.dll
;extension=php_pdo_mysql.dll
After restarting apache all was working as expected.
重新启动 apache 后,一切都按预期工作。
回答by Dmytro Zarezenko
This article can help you Configuring PHP with MySQL for Apache 2 or IIS in Windows. Look at the section "Configure PHP and MySQL under Apache 2", point 3:
本文可以帮助您在 Windows 中为 Apache 2 或 IIS 使用 MySQL 配置 PHP。看《Apache 2下配置PHP和MySQL》一节,第3点:
extension_dir = "c:\php\extensions" ; FOR PHP 4 ONLY
extension_dir = "c:\php\ext" ; FOR PHP 5 ONLY
You must uncomment extension_dir param line and set it to absolute path to the PHP extensions directory.
您必须取消注释 extension_dir 参数行并将其设置为 PHP 扩展目录的绝对路径。
回答by RM.
Copy libmysql.dll from the PHP installation folder to the windows folder.
将 libmysql.dll 从 PHP 安装文件夹复制到 windows 文件夹。
回答by Spawn
I've been searching for hours and no one could help me. I did a simple thing to solve this problem. (WINDOWS 10 x64)
我一直在寻找几个小时,没有人可以帮助我。我做了一个简单的事情来解决这个问题。(Windows 10 x64)
Follow this:
按照这个:
1 - Go to your php_mysqli.dll path (in my case: C:/xampp/php/ext);
1 - 转到你的 php_mysqli.dll 路径(在我的例子中:C:/xampp/php/ext);
2 - Move the php_mysqli.dll to the previous folder (C:/xampp/php);
2 - 将 php_mysqli.dll 移动到上一个文件夹 (C:/xampp/php);
3 - Open php.ini and search the line: "extension: php_mysqli.dll";
3 - 打开 php.ini 并搜索行:“扩展名:php_mysqli.dll”;
4 - Change to the path where is your file: extension="C:\xampp\php\php_mysqli.dll";
4 - 更改为您的文件所在的路径:extension="C:\xampp\php\php_mysqli.dll";
5 - Restart your application (wampp, xampp, etc.) and start Apache Server;
5 - 重新启动您的应用程序(wampp、xampp 等)并启动 Apache 服务器;
The problem was the path ext/php_mysqli.dll, I've tried changing the line to extension="C:\xampp\php\ext\php_mysqli.dll" but doesn't worked.
问题是路径 ext/php_mysqli.dll,我尝试将行更改为 extension="C:\xampp\php\ext\php_mysqli.dll" 但没有用。
回答by Ocheng Jerome Jesse
I simply copied my php_myslqli.dll file from ert folder back to php folder, and it worked for me after restarting my Apache and MySQL from the control Panel
我只是将我的 php_myslqli.dll 文件从 ert 文件夹复制回 php 文件夹,并且在从控制面板重新启动我的 Apache 和 MySQL 后它对我有用
回答by SamWanekeya
Simply specify the directory in which the loadable extensions (modules) reside in the php.ini file from
只需从 php.ini 文件中指定可加载扩展(模块)所在的目录
; On windows:
extension_dir="C:\xampp\php\ext"
to
到
; On windows:
;extension_dir = "ext"
Then enable the extension if it was disabled by changing
如果通过更改禁用扩展,则启用扩展
;extension=mysqli
to
到
extension=mysqli
回答by ABO YAZAN
I had the same problem and I solved it. You can solve it too if you follow these steps:
我有同样的问题,我解决了它。如果您按照以下步骤操作,您也可以解决它:
- you have to install PHP to C:/phpor your current version locate it to this path and specify it as a system variable
then open xampp program and click config and open php.ini and uncomment the following lines:
extension=pdo_mysql extension=pdo_mysql extension=openssl
- 您必须将 PHP 安装到C:/php或您当前的版本将其定位到此路径并将其指定为系统变量
然后打开 xampp 程序并单击配置并打开 php.ini 并取消注释以下行:
extension=pdo_mysql extension=pdo_mysql extension=openssl
回答by user3230982
Its an issue of extension directory. You need to change php extension directory manually to work this.
它是扩展目录的问题。您需要手动更改 php 扩展目录才能执行此操作。
If you are using AMPP Server, do the following
如果您使用的是 AMPP 服务器,请执行以下操作
Goto settings -> PHP -> Configuration
转到设置 -> PHP -> 配置
in php7.3.ini Find, (Versions might change)
在 php7.3.ini 中找到,(版本可能会变)
extension_dir = "" , (Already having some path)
extension_dir = "" , (已经有了一些路径)
and change value to
并将值更改为
extension_dir = "C:\Program Files\Ampps\php-7.3\ext"
extension_dir = "C:\Program Files\Ampps\php-7.3\ext"
If you are using XAMP
如果您使用的是 XAMP
Goto XAMP Settings, Apache -> PHP.ini
转到 XAMP 设置,Apache -> PHP.ini
Find, extension_dir = in php.ini, and set path of the php extension folder of your local machine. See the below example.
在php.ini中找到extension_dir=,设置本机php扩展文件夹的路径。请参阅以下示例。
extension_dir = "C:\php\ext" (Check your path properly)
extension_dir = "C:\php\ext"(正确检查你的路径)
回答by Sundar
sudo apt-get install php7.2-mysql
sudo apt-get install php7.2-mysql
extension=mysqli.so (add this php.ini file)
extension=mysqli.so(添加这个 php.ini 文件)
sudo service apahce2 restart
Please use above commands to resolve mysqli-extension missing error
请使用以上命令解决mysqli-extension缺失错误