问题描述
我正在尝试在 PHP 7.1.0 中安装 mongodb 扩展,但基本上该扩展不是由 PHP 加载的(不使用 php_info() 显示并且不抛出任何错误,只是不加载),我也已关注和搜索许多教程,但没有任何效果.
MongoDB 4.0.2 已安装并按预期工作.PHP 7.1 按预期运行.
步骤:
1) 下载 PECL 兼容(PHP 版本和线程安全/无线程安全)mongodb 驱动程序.
2) 在 PHP 安装中打开/ext 目录,将下载的 .dll 扩展名放在里面.
3) 编辑 php.ini 文件并使用 (extension=php_mongodb.dll) 启用附加代码的 mongodb 扩展.
4) 重启 Apache 服务.
对应的php.ini文件正在加载正确(见下方打印)
我尝试使用另一个旧版本的扩展程序,但没有奏效.
我安装了许多 PHP 版本,我也在 5.6 中尝试过,但效果不佳.
我在其他机器上使用 PHP 7.2 尝试过但没有成功,我搜索了太多没有找到解决方案,我希望有人能帮忙!谢谢.
参考文献:
Windows 8.1
解决这个问题,需要从PHP安装复制一些.dll文件到Apache安装,希望能帮到人!参考
I'm trying to install the mongodb extension in PHP 7.1.0 but basically the extension is not loaded by PHP (not displayed using php_info() and not throws any error, just not load), i have follow and searched too many tutorials and nothing has worked.
MongoDB 4.0.2 is installed and working as expected. PHP 7.1 is working as expected.
Steps made:
1) Download PECL compatible (PHP version and thread safety/no thread safety) mongodb driver.
2) Open /ext directory in PHP installation and put the .dll extension downloaded on it.
3) Edit php.ini file and enable the mongodb extension appending the code using (extension=php_mongodb.dll).
4) Restart Apache service.
The corresponding php.ini file is loading correclty (see print below)
I tryed use another old versions of the extension and not worked.
I have many PHP versions installed, i tryed in 5.6 too, and not worked as well.
I have tryed in other machine using PHP 7.2 and not worked, i searched too many and not found a solution, i hope some person can help! Thanks.
References:
Windows 8.1
http://php.net/manual/en/mongodb.installation.windows.php
https://pecl.php.net/package/mongodb
All marked as blue i have tried to install, and all downloads are made Thread Safety x64 (correspondent architecture).
To solve this, need to copy some .dll files from PHP install to Apache install, hope to help someone! Reference
这篇关于Windows MongoDB PHP 扩展未加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!