I’m encountering an issue when trying to use the MongoDB extension in PHP.
I used the following command to install the MongoDB PHP library:
composer require mongodb/mongodb
However, I’m getting the following error:
PHP Warning: PHP Startup: Unable to load dynamic library 'mongodb' (tried: C:xamppphpextmongodb (The specified module cannot be found), C:xamppphpextphp_mongodb.dll (The specified module cannot be found)) in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'mongodb' (tried: C:xamppphpextmongodb (The specified module cannot be found), C:xamppphpextphp_mongodb.dll (The specified module cannot be found)) in Unknown on line 0
Cannot use mongodb/mongodb's latest version 1.19.1 as it requires ext-mongodb ^1.18.0 which is missing from your platform.
The error indicates that the ext-mongodb extension is missing, but I have already taken the following steps:
Downloaded the PECL extension:
php_mongodb-1.19.3-8.2-ts-vs16-x64.zip
Extracted the php_mongodb.dll file and moved it to:
C:xamppphpext
Added the following line to my php.ini file:
extension=mongodb
I also tried:
extension=php_mongodb.dll
extension=”C:/xampp/php/ext/mongodb”
Restarted Apache, but I still encounter the same error.
Additional Information:
Output of php -i:
PHP Version => 8.2.12
Thread Safety => enabled
Architecture => x64
Expected Result:
Successfully load the MongoDB extension so that I can use the MongoDB library in my PHP project.
Actual Result:
The following error persists:
PHP Warning: PHP Startup: Unable to load dynamic library 'mongodb' (tried: C:xamppphpextmongodb (The specified module cannot be found), C:xamppphpextphp_mongodb.dll (The specified module cannot be found)) in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'mongodb' (tried: C:xamppphpextmongodb (The specified module cannot be found), C:xamppphpextphp_mongodb.dll (The specified module cannot be found)) in Unknown on line 0
What am I doing wrong, and how can I resolve this issue?
Daniel Gallego is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.