Error: Class "MongoDB\Driver\Manager" not found

I am trying to setup MongoDB for php, when creating wordpress plugin, but get this error: Fatal error : Uncaught Error: Class “MongoDB\Driver\Manager” not found in C:\Users\qhuser\Local Sites\wordpress-with-react\app\public\wp-content\plugins\test\vendor\mongodb\mongodb\src\Client.php:118

Here are my folders:

Here is where the problem is appearing:

I think it may be some problem with the versions, not sure at all.

installed mongodb with composer, added the mongo .dll file in the ext, configured the .ini file, saw that the support is included inside the plugin.

Is it needed to set-up mongo support for the wordpress website also, because I don’t think the problem is coming from there.

Thank you for any kind of help!

Did you install the extension as well as the library? See

Also created test file, with <?php phpinfo() ?> inside, and ran it inside the powershell, did that to confirm that the support for MongoDB is present inside powershell:


Can it be a problem with MongoDB/Manager?

I installed the library via the composer require mongodb/mongodb and added the extension manually into the /ext folder inside the /php folder. Also added extension=php_mongodb.dll inside the php.ini file.

Don’t know if this would help, but when I run php -m or php --ri mongodb inside windows powershell I see MongoDB there and the appropriate support, but when I do php_info(), no support is shown inside the wordpress website, for which I am developing the plugin, I suppose it is because php_info() is ran for different enviroment and has nothing to do with the MongoDB setup inside the plugin?

Thank you, @Jack_Woehr !

I think you’re probably right about that, @Ilia_Popov … I’m not expert on the setup of WordPress on Windows.

I’ve got it figured out!

I know it is not only Mongo related, but I wanted to share the solution in case it helps someone else down the line:

When you’re building a website for local development (like I did with Localwp), and you’re enhancing the functionality of the WordPress site (such as adding a custom plugin with the npx create-divi-extension command), it’s essential to ensure that any additional libraries and extensions you include in the custom plugin (like MongoDB in my case) are also supported by the actual Localwp website.

For Windows users, here’s what you need to do: if you add extension=php_mongodb.dll in the php.ini file of the plugin and place the php_mongodb.dll file (with the correct version and type safety) in the /ext folder, which the plugin uses, you also need to add that extension to the appropriate php.ini & /ext folders of the Localwp website. These folders can be found here: C:\Users\...\AppData\Roaming\Local\lightning-services\ & C:\Users\...\AppData\Roaming\Local\run\.

I hope this helps someone out there!

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.