I am trying to connect my laravel project to a mongodb. My php version is 8.1. I downloaded the threadsafe x64 for php 8.1 from text and pasted the dll file in my ext folder in php folder of xampp. And activated the module in php.ini by
extension=mongodb
bit when trying to check if mongodb extension is activated by php --ini
it results in
PHP Warning: PHP Startup: Unable to load dynamic library 'mongodb' (tried: extmongodb (The specified module could not be found), extphp_mongodb.dll (The specified module could not be found)) in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'mongodb' (tried: extmongodb (The specified module could not be found), extphp_mongodb.dll (The specified module could not be found)) in Unknown on line 0
Configuration File (php.ini) Path
the file is named as php_mongodb.dll in ext folder but its still not taking it.
i checked in http://localhost/dashboard/phpinfo.php to see if it is enabled and mongodb extension is showing in it with all the available options.
i tried changing the php.ini from extension=mongodb
to extension=php_mongodb.dll
and then restarted xampp.but the error was
PHP Warning: PHP Startup: Unable to load dynamic library 'php_mongodb.dll' (tried: extphp_mongodb.dll (The specified module could not be found), extphp_php_mongodb.dll.dll (The specified module could not be found)) in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'php_mongodb.dll' (tried: extphp_mongodb.dll (The specified module could not be found), extphp_php_mongodb.dll.dll (The specified module could not be found)) in Unknown on line 0
Configuration File (php.ini) Path:
Loaded Configuration File: D:xamppphp81php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
so the preceding php or last.dll in php.ini was not the problem. besides the other extensions like mysql are enabled in it like extension=pdo_mysql
without the php_and .dll. what did i do wrong?
2
Answers
It may happen that something is trying to get to the extension folder from a path that you’d see if php were installed as a standalone. Installing the same version of php and placing the .dll in that folder as well as your xampp’s php folder it may solve the issue.
You need to verify the following:
Check whether your PHP is thread safe or non thread safe and download the mongodb version accordingly. Moreover, also check whether you are on x64 or x86 architecture. Both these information are visible if you call and print phpinfo() method in your php file.
Verify the path of your php.ini file, might be you have applied the changes in some other php.ini file. Loaded php.ini path is visible in phpinfo() method.
Check the extension directory path in your php.ini whether it is:
By following these steps you should be able to successfully load the MongoDb extension. I am already using it and it works perfectly fine at my end. I already did the above steps as I got few issues.