Cannot configure php with mongodb inside Local

What issue or error are you experiencing?

I am trying to setup MongoDB on one of my test websites, that I created with Local. I follow the guideline, that is presented in the MongoDB documentation, but then whenever I open the site shell of that website, it first warns me: Warning: PHP Startup: Unable to load dynamic library ‘php_mongodb.dll’ (tried: C:/Users/qhuser/AppData/Roaming/Local/lightning-services/php-8.1.23+0/bin/win64/ext\php_mongodb.dll (The specified procedure could not be found), C:/Users/qhuser/AppData/Roaming/Local/lightning-services/php-8.1.23+0/bin/win64/ext\php_php_mongodb.dll.dll (The specified module could not be found)) in Unknown on line 0.

Then I cannot see the support for mongo added, when running php -m command.

Is this problem with Local, and can someone help me how to configure the php.ini & the ext folder properly, in order to make it work, should I restart (because I did several times) or do something else.

I am into dead end for now.

What steps can be taken to replicate the issue? Feel free to include screenshots, videos, etc

System Details

  • 9.0.1

  • Windows 10

Hi @ipp02

I’m not familiar with working with MongoDB, but the error message looks similar to this one I’ve seen crop up for ImageMagick. Sharing this as it might be helpful in troubleshooting:

Hey, @Nick-B, do you know if I should also configure the php.ini of the Localwp website, with support for mongodb, in order to make the plugin work. Thank you! :slight_smile:

What is it that you need to configure in php.ini? Generally speaking, changes in there can be saved and then you Stop and Start the site so it can set those.

The same support for MongoDB, that is configured inside the custom plugin that I am developing. If it is needed of course? @Nick-B

Again I’m not familiar with MongoDB so I’m unsure with what is required here. Do they have any documentation or support regarding how best to implement it locally?

I see we have an older feature request here for MongoDB support I’ll share here for you or others to upvote, comment and follow.

I am doing everything according to the documentation and this is why I am confused that it may be a problem with Localwp instead? Thank you!

I solved it!

Will share the solution, in order to hopefully save someone some time:

When you are creating Localwp website for local development, in order to enhance the functionality of the wordpress website (i.e., in my case, add custom plugin with npx create-divi-extension command), make sure, that whatever additional libraries and extensions you add to the custom plugin ( like MongoDB in my case ), you also add support for the extension to the actual Localwp website.

For example for windows users, if you add extension=php_mongodb.dll in the php.ini file of the plugin and add the php_mongodb.dll file (with appropriate version and type safety) to the /ext folder, which the plugin uses, also add that extension to the appropriate php.ini & /ext of the localwp website. They are located inside such folders: C:\Users\...\AppData\Roaming\Local\lightning-services\ & C:\Users\...\AppData\Roaming\Local\run\.

Hopefully this would be of some help to someone!


Hello @ipp02 -

Thank you for sharing what worked for you - we appreciate that!

Happy building,

Sam :green_heart:

1 Like

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