wamp 无法加载 mysqli 扩展

发布于 2024-07-13 11:10:24 字数 1464 浏览 9 评论 0原文

WAMP 安装正常,没有问题,但是...

当转到 phpMyAdmin 时,我从 phpMyAdmin 收到如下错误:

Cannot load mysqli extension. Please check your PHP configuration

另外,phpMyAdmin 文档对此错误消息的解释如下:

要连接到 MySQL 服务器,PHP 需要一组 MySQL 函数 称为“MySQL 扩展”。 该扩展可能是 PHP 的一部分 分发(编译),否则需要加载 动态地。 它的名称可能是 mysql.so 或 php_mysql.dll。 phpMyAdmin 尝试加载扩展但失败。 通常, 通过安装一个名为“PHP-MySQL”的软件包解决了问题 或类似的东西。

最后,apache_error.log 文件有以下 PHP 警告(请参阅 mySQL 警告):

PHP Warning: Zend Optimizer does not support this version of PHP - please upgrade to the latest version of Zend Optimizer in Unknown on line 0
PHP Warning: Zend Platform does not support this version of PHP - please upgrade to the latest version of Zend Platform in Unknown on line 0
PHP Warning: Zend Debug Server does not support this version of PHP - please upgrade to the latest version of Zend Debug Server in Unknown on line 0
PHP Warning: gd wrapper does not support this version of PHP - please upgrade to the latest version of gd wrapper in Unknown on line 0
PHP Warning: java wrapper does not support this version of PHP - please upgrade to the latest version of java wrapper in Unknown on line 0
PHP Warning: mysql wrapper does not support this version of PHP - please upgrade to the latest version of mysql wrapper in Unknown on line 0

因此,由于某种原因 PHP 无法识别 mysql 扩展。

有人知道为什么吗? 有什么解决方案或解决方法吗?

WAMP installed fine, no problems, BUT...

When going to phpMyAdmin, I get the error from phpMyAdmin as follows:

Cannot load mysqli extension. Please check your PHP configuration

Also, phpMyAdmin documentation explains this error message as follows:

To connect to a MySQL server, PHP needs a set of MySQL functions
called "MySQL extension". This extension may be part of the PHP
distribution (compiled-in), otherwise it needs to be loaded
dynamically. Its name is probably mysql.so or php_mysql.dll.
phpMyAdmin tried to load the extension but failed. Usually, the
problem is solved by installing a software package called "PHP-MySQL"
or something similar.

Finally, the apache_error.log file has the following PHP warnings (see the mySQL warning):

PHP Warning: Zend Optimizer does not support this version of PHP - please upgrade to the latest version of Zend Optimizer in Unknown on line 0
PHP Warning: Zend Platform does not support this version of PHP - please upgrade to the latest version of Zend Platform in Unknown on line 0
PHP Warning: Zend Debug Server does not support this version of PHP - please upgrade to the latest version of Zend Debug Server in Unknown on line 0
PHP Warning: gd wrapper does not support this version of PHP - please upgrade to the latest version of gd wrapper in Unknown on line 0
PHP Warning: java wrapper does not support this version of PHP - please upgrade to the latest version of java wrapper in Unknown on line 0
PHP Warning: mysql wrapper does not support this version of PHP - please upgrade to the latest version of mysql wrapper in Unknown on line 0

So, for some reason PHP is not recognizing the mysql extension.

Anyone know why? Any solution or workaround?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(19

月下伊人醉 2024-07-20 11:10:27

我努力尝试
一次又一次地安装wamp,
通过检查 php.ini 文件,
通过重新启动机器,
通过替换index.php文件,

但没有任何效果。
然后我转到 wamp/temp 并删除所有文件,现在工作正常。

i tried hard by
installing the wamp again and again,
by checking the php.ini file,
by restarting the machine,
by replacing the index.php file,

but none works.
then i go to the wamp/temp and deleted all files and it works fine now.

梦里泪两行 2024-07-20 11:10:27

我在 Windows 中将路径变量设置为 php 的某个随机版本。

修复方法是更新它并将其设置到我的 wampserver 安装中的文件夹中:

C:\wamp64\bin\php\php5.6.38

然后我意识到这对于我的特定情况也是错误的,我实际上应该从 vagrant 中运行脚本。 活到老,学到老。

I had path variable in windows set to some random version of php.

The fix was to update it and set it to the folder within my wampserver installation:

C:\wamp64\bin\php\php5.6.38

Then I realized this is wrong also for my specific case, and I should actually be running the script from within vagrant. Live and learn.

百思不得你姐 2024-07-20 11:10:27

由于不同的原因,我遇到了这个问题:

检查 PHP 错误日志(从 Wamp 托盘获取 -> PHP -> PHP 错误日志。
我在编辑 php.ini 文件时遇到语法错误。
检查日志并清除错误。 这将正确打开您的 PhpMyAdmin。

I had this issue because of a different reason:

Check the PHP Error Log(Get from the Wamp Tray -> PHP -> PHP Error Log.
I had a syntax error in the php.ini file while I was editing the file.
Check the log and clear the error. This will open your PhpMyAdmin properly.

夏天碎花小短裙 2024-07-20 11:10:27

检查 phpForApache.ini 文件的扩展名。 该文件应该与您的 php.ini 文件相同。

Check your phpForApache.ini file's extensions. This file should be same as your php.ini file.

幽蝶幻影 2024-07-20 11:10:26

我有同样的问题。 我安装了 WAMP 服务器。 一切都工作正常。 然后有一天,我重新启动计算机,它就停止工作了! 我拼命地尝试查看所有帮助帖子并执行它们,但没有任何效果。

他们通常建议您做的是,首先转到您的 php.ini 文件并确保您的“extension_dir”设置正确。 然后确保这两行没有被注释(删除前面的 ; ):
扩展名=php_mysql.dll
extension=php_mysqli.dll

然后有人建议我下载这两个文件的新副本,但没有任何效果。 我还尝试卸载所有内容(php/mysql/apache)并多次重新安装 WAMP 服务器的新副本,但没有成功。

最后我设法找到了替代解决方案。 我切换到“easyphp”(http://www.easyphp.org/)。 这与WAMP 非常相似。 首先,我对 SQL 数据库进行了备份,以便可以在新安装中重新加载它们。

然后我安装了“easyphp”,一切似乎都工作正常。 我从备份中重新加载了 SQL 数据库,现在一切恢复正常。

我希望有人遇到类似的问题。 会发现这很有用。 如果有人真的找到了使 WAMP 服务器正常工作的修复程序。 请务必将其发布在这里,这样很多人都会受益。

I had the same problem. I had WAMP server installed. All was working fine. Then one day I restarted my computer and it just stopped working! I tried desperately going through all help posts and doing them but nothing worked.

What they usually suggest you do is, first go to your php.ini file and make sure your 'extension_dir' is properly set. Then to make sure these two lines are not commented (remove the ; infront):
extension=php_mysql.dll
extension=php_mysqli.dll

Then some suggested that I download fresh copies of these two files but none worked. I also tried uninstalling everything (php/mysql/apache) and reinstalled fresh copies of WAMP server several times but with no luck.

Finally I managed to find an alternative solution. I switched to 'easyphp' (http://www.easyphp.org/). This is something very similar to WAMP. First I made backups of my sql databases so I can reload them on the new installation.

Then I installed 'easyphp' and everything seems to work fine. I reloaded my sql databases from my backup and now things are back to normal.

I hope someone suffering from a similar prob. will find this useful. If someone has really found a fix to make WAMP server work. Pls do be kind enough to post it here so many will benefit.

丢了幸福的猪 2024-07-20 11:10:26

在 wampserver 中转到 php.ini。 打开文件并通过删除相应操作系统的分号 (;) 取消注释 extension=msql.dll。

in wampserver go to php.ini. open the file and uncomment extension=msql.dll by removing semicolon(;) for respective operating sytem.

哎呦我呸! 2024-07-20 11:10:26

只需在 php.ini 中添加:

[PHP_MCRYPT]
extension=php_mcrypt.dll
[PHP_MYSQL]
extension=php_mysql.dll
[PHP_MYSQLI]
extension=php_mysqli.dll

Just add in your php.ini:

[PHP_MCRYPT]
extension=php_mcrypt.dll
[PHP_MYSQL]
extension=php_mysql.dll
[PHP_MYSQLI]
extension=php_mysqli.dll
妄司 2024-07-20 11:10:26

还要设置 mysql 密码:

SET PASSWORD FOR root@localhost=PASSWORD('your_password');

以及 config.inc.php 中的 phpmyadmin mysql 密码:

$cfg['Servers'][$i]['password'] = 'your_password';

Also setup the mysql password:

SET PASSWORD FOR root@localhost=PASSWORD('your_password');

And the phpmyadmin mysql password in config.inc.php:

$cfg['Servers'][$i]['password'] = 'your_password';
又爬满兰若 2024-07-20 11:10:26

遇到同样的问题,用wamp。 尝试用备份替换当前版本的 php.ini。 其中有一个:wamp\bin\php\php5.3.0phpForApache.txt。 为我工作。

Had the same problem, with wamp. Try to exchange your current version of php.ini with a backup. There is one in: wamp\bin\php\php5.3.0phpForApache.txt. Worked for me.

昵称有卵用 2024-07-20 11:10:26

只是想插话一下这个。 使用Wamp Server 2.0,并使用Zend Studio和Zend调试器进行开发。

到目前为止我还无法(将在某个时候回到它)让 zend 调试器与 php 5.3 一起工作。 所以在 wamp 中我加载了早期的 php 版本,5.2.11。 当我访问 php 我的管理员时,我遇到了同样的错误。

我要做的就是将 php.ini 文件中的“extension_dir”值更改为 c:/wamp/bin/php/php5.2.11/ext/ 以匹配我使用的 php 版本。 之后一切都很好。

Just wanted to chime in on this one. Using Wamp Server 2.0, and using Zend Studio with Zend debugger for development.

I wasn't able as of yet (will get back to it at some point) to get the zend debugger working with php 5.3. So in wamp I loaded an earlier php version, 5.2.11. I was getting the same error when acessing php my admin.

What I had to do was change the php.ini file value for "extension_dir" to c:/wamp/bin/php/php5.2.11/ext/ to match the version of php I was using. After that it was all good.

反目相谮 2024-07-20 11:10:26

我遇到了这个问题,花了两个小时尝试了网上所有的解决方案,但没有一个有效。

尝试了这个,它醒了:

改变

mysql.default_host =

mysql.default_host = 本地主机

并重新启动 WAMP。 注意你是否使用mysqli。

I had this problem and spent 2 hours trying all the solutions online, none worked.

Tried this, and it woked:

Change

mysql.default_host =

to

mysql.default_host = localhost

and restart WAMP. pay attention if you are using mysqli or not.

可爱咩 2024-07-20 11:10:26

我有同样的错误。 当我增加脚本内存大小并启用 E_ALL 然后重新启动服务器时,我在 phpmyadmin 中收到该错误。 我所要做的就是重新启动计算机来修复它!

I had the same error. When I increased the script memory size and enabled E_ALL then restarted the server, I got that error in phpmyadmin. All I had to do to fix it was restart my computer!

十级心震 2024-07-20 11:10:26

我很长一段时间都遇到这个问题。
尝试了我在论坛上阅读的所有内容,这终于对我有用:
打开你的 php.ini (我假设你已经加载了好的 php.ini...)并找到这一行
mysqli.default_port = 3306
更改为
mysqli.default_port = 80
重新启动所有服务
转到 localhost/phpmyadmin -> 行不通
重新打开 php.ini 文件并重新输入此
mysqli.default_port = 3306
重新启动所有服务
为我工作。

I got this problem for a long time.
Tried all I've read on forums and this finally worked for me:
Open your php.ini (I assume you've got the good one that is loaded...) and find this line
mysqli.default_port = 3306
change for
mysqli.default_port = 80
Restart all services
Go to localhost/phpmyadmin -> won't work
Reopen the php.ini file and retype this
mysqli.default_port = 3306
Restart all services
Worked for me.

鸠魁 2024-07-20 11:10:26

对我来说,在搜索了所有日志/互联网/所有非正常事物之后,我完成了这个工作。
您必须通过以下方式注册 dl:

通过申请:

WAMP -> PHP settings -> enable dl

# php.ini #

; Whether or not to enable the dl() function.  The dl() function does NOT work
; properly in multithreaded servers, such as IIS or Zeus, and is automatically
; disabled on them.
; http://php.net/enable-dl
enable_dl = On

For me worked this, after searching all logs/internet/every non-normal things.
You have to register dl by:

Through application:

WAMP -> PHP settings -> enable dl

or

# php.ini #

; Whether or not to enable the dl() function.  The dl() function does NOT work
; properly in multithreaded servers, such as IIS or Zeus, and is automatically
; disabled on them.
; http://php.net/enable-dl
enable_dl = On
绮烟 2024-07-20 11:10:26

我刚刚安装了 WampServer,也遇到了同样的问题。 我找到了适合我的解决方案,它非常简单。

  1. 禁用 PHP 扩展 php_mysqli
  2. 重启WampServer,访问本地phpmyadmin
  3. 重新启用 php_mysqli。
  4. 重复步骤 2。

刷新几次页面后,剩余的错误板(关于 MySQLsqli)消失了。

I have just installed WampServer, and faced same problem. I have found solution, that works for me, it is ridiculously simple.

  1. Disable PHP extension php_mysqli.
  2. Restart WampServer, visit local phpmyadmin.
  3. Enable php_mysqli back.
  4. Repeat step 2.

After few page refreshes, remaining errors plates (about MySQL and sqli) had gone.

谁对谁错谁最难过 2024-07-20 11:10:25

我删除了程序文件中的 PHP,一切都开始工作,问题是有两次安装 pHp

I deleted the PHP in program files ad everything started working , the problem that there two installations of pHp

野味少女 2024-07-20 11:10:25

我尝试了很多解决方案,但没有一个对我有用。 我尝试了以下解决方案:

  • 重新启动 wampserver
  • 重新安装 wampserver
  • 重新启动计算机
  • 以及此问题中提到的所有其他解决方案。

然而,这些都不起作用。 然后我发现我的PHPMyAdmin不能在chrome中工作,而在firefox中工作。 所以我尝试清除缓存,重新启动浏览器等,但仍然不起作用。

然后我删除了 C:\wamp\tmp 中的所有文件,然后再次尝试,它起作用了。 我不确定它为什么有效,但这就是我的想法。 会话已缓存且未清除。 因此,一旦我删除了该目录中的所有文件,所有会话都被删除,因此它工作正常。

I tried many solutions, and none worked for me. I tried the following solutions:

  • Restart wampserver
  • Reinstall wampserver
  • restart machine
  • and all other solutions mentioned in this question.

However, none of these worked. Then I found that my PHPMyAdmin was not working in chrome and was working in firefox. So I tried clearing cache, restarting browser etc, but still it would not work.

Then I deleted all the files from C:\wamp\tmp and then tried again, and it works. I am not sure why it works, but here is what I think. The session was cached and not getting cleared. So as soon as I deleted all files in this directory all the sessions were deleted and hence it worked fine.

思慕 2024-07-20 11:10:25

首先,确保 php.ini 文件正在加载 mysqli 扩展。
如果您使用的是WAMPServer,请点击系统托盘中的图标,进入PHP -> PHP Extensions 并确保选中它。 如果没有,请进入 php.ini 文件并确保以下行:extension=php_mysqli.dll 未注释(例如,删除 ; 如果存在)。 如果该行不存在,请添加它。

如果这仍然不起作用,请仔细检查是否正在加载正确的 php.ini 文件。
为此,请查看您的 phpinfo()(WAMPServer 的此处)。 向下滚动到已加载配置文件行,查看正在加载哪个php.ini确保它是正确的文件。 如果您使用的是 WAMPServer,则它应该是(WAMP 安装文件夹)\bin\apache\Apache2.2.11\bin\php.ini。 默认情况下,它是C:\wamp\bin\apache\Apache2.2.11\bin\php.ini`。

如果正在加载不同的 php.ini 文件,只需将其重命名为其他名称,以便 PHP 尝试在其他位置找到该文件。 应该有一种方法来指定您想要使用哪个,但我完全忘记了如何做到这一点...

如果这仍然不起作用...尝试弄乱 phpMyAdmin 的设置,或使用另一个答案,但我'恐怕我无能为力。

First, make sure that the php.ini file is loading the mysqli extension.
If you are using WAMPServer, click on the icon in the system tray, go to PHP -> PHP Extensions and make sure it is checked. If not, go into the php.ini file and make sure that the line: extension=php_mysqli.dll is uncommented (eg, remove the ; if it exists). If that line does not exist, add it.

If this still does not work, double check that the right php.ini file is being loaded.
To do so, view your phpinfo() (Here for WAMPServer). Scroll down to the Loaded Configuration File row and see which php.ini is being loaded.Make sure it is the right file. If you're using WAMPServer, it should be(WAMP INSTALL FOLDER)\bin\apache\Apache2.2.11\bin\php.ini. By default, it isC:\wamp\bin\apache\Apache2.2.11\bin\php.ini`.

If a different php.ini file is being loaded, just rename it to something else so that PHP will try and find the file somewhere else. There should be a way to specify which on eyou want to use, but I forget exactly how to do that...

If this still doesn't work... Try messing around with phpMyAdmin's settings, or using another answer, but I'm afraid I can't help beyond this.

风透绣罗衣 2024-07-20 11:10:25

我正在使用两个 PHP 版本 1) 5.2.9 和 2) 5.2.13 运行 WAMP。

根据站点要求,我需要将 PHP 版本从 5.2.13 更改为 5.2.9。 交换 PHP 版本后,错误是“mysqli 扩展丢失”。 经过长时间调试后,我知道这是由于 php.ini 文件中的“extension_dir”路径错误造成的。

所以我改变了它的值:

旧:“extension_dir”c:/wamp/bin/php/php5.2.13/ext/

新:“extension_dir”c:/wamp/bin/php/php5.2.9/ext/

重新启动了所有服务wamp服务器,然后就修复了。

I was running WAMP with two PHP versions 1) 5.2.9 and 2) 5.2.13.

As per site requirement i needed to change PHP version to 5.2.9 from 5.2.13. after swapping PHP version, error was "mysqli extension is missing". after debugging long time i get to know it was due to wrong "extension_dir" path in php.ini file.

So i changed its value:

Old: "extension_dir" c:/wamp/bin/php/php5.2.13/ext/

New: "extension_dir" c:/wamp/bin/php/php5.2.9/ext/

Restarted All services in wamp server, then it's fixed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文