PHP Startup: Unable to load dynamic library 'php_mongodb.dll'

旧巷老猫 提交于 2021-02-05 12:21:09

问题


I'm trying to get Laravel MongoDB working in my local machine (Windows 10 home, x64) by following this tutorial

  1. I have installed XAMPP 7.3.11 on D:\xampp succesfully and tested that the server can be reached (enter localhost:80 on browser)
  2. I proceeded on extracting php_mongodb.dll I got from pecl(mongodb 1.6.0 for Windows, 7.3 Non Thread Safe, x64 ) on D:\xampp\php\ext and add the line extension=php_mongodb.dll on the file D:\xampp\php\php.ini

  3. After selecting 'the command-line PHP you want to use' to D:\xampp\php\php.exe, the setup then gave the following output:

    The PHP exe file you specified did not run correctly: D:\xampp\php\php.exe

    The php.ini used by your command-line PHP is: D:\xampp\php\php.ini

    A setting in your php.ini could be causing the problem: Either the 'extension_dir' value is incorrect or the dll does not exist.

    Program Output: PHP Warning: PHP Startup: Unable to load dynamic library 'php_mongodb.dll' (tried: D:\xampp\php\ext\php_mongodb.dll (The specified module could not be found.), D:\xampp\php\ext\php_php_mongodb.dll.dll (The specified module could not be found.)) in Unknown on line 0

Commenting out the line extension=php_mongodb.dll will execute D:\xampp\php\php.exe without any warning. But I would need php to be aware of php_mongodb.dll during composer installation, right?

So how to resolve this problem? The file definitely exists in the folder, and the required modification on php.ini has been provided. I have already looked around and some people mentioning the path in extension_dir must be written in full path. But I have already checked that the line on my php.ini is extension_dir="D:\xampp\php\ext"


回答1:


Problem resolved.

Cause: I was using Non Thread Safe php_mongodb.dll, while the PHP installed by XAMPP is a Thread Safe one.

After replacing php_mongodb.dll with the thread safe version, there's no error and I can successfully completed composer installation.




回答2:


There are many solution to resolve this error:

1) please change the extension=php_mongodb.dll to extension=php_mongo.dll.

2) If still error generated other solution is to download proper Dll file. The reason behind this is we use 64 Bit supported DLL file 64 Bit system. But the wamp/xampp architecture could be 32 Bit. We need to use based on the wamp/xampp architecture not the windows architecture. So, try to find relevant version of DLL file to the wamp/xampp architecture.

Please try with these two solution.



来源:https://stackoverflow.com/questions/58968375/php-startup-unable-to-load-dynamic-library-php-mongodb-dll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!