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

Hi all,

Currently, Im facing an error with PHP MongoDB DLL, I’m trying to set it up, but Im getting the following Error message:

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

I do have PHP 8.3.6 installed on C/PHP Im not using xampp or wampserver; I already tried to use multiple DLL from Releases · mongodb/mongo-php-driver · GitHub
Version that I already Tried are 1.18.0–7.4-ts-x64 and x86, 1.18.1–7.4-ts-x64 and x86

I tried adding extension=php_mongodb or extension=php_mongodb.dll into the php.init file, but is not working as well

Im using W11

When installing PHP extensions on Windows, it’s important to download the correct file that corresponds to your PHP version, thread safety, and CPU architecture. Visit the Windows Installation Docs for more details.

The files you mentioned were compiled for PHP 7.4, so they would not be expected to work. In your case, the file you’re looking for is 1.18.1-8.3-?-?, with the last two placeholders indicating thread safety and architecture, the latter I presume to be x64.

You can also run the following command to get the filename you’re looking for:

php.exe -r 'printf("php_mongodb-x.y.z-%d.%d-%s-%s", PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_ZTS ? "ts" : "nts", PHP_INT_SIZE === 8 ? "x64" : "x86");'

Be aware that I only tested the above on Linux as I don’t have a Windows box with PHP installed, but I’d assume that you can invoke PHP the same way on Windows. Either way, the printf statement given will print the filename pattern you’re looking for, as the PHP_ZTS and PHP_INT_SIZE can be used to deduce the thread safety and architecture.

I hope this helps installing the extension.