Learn how to install MongoDB on Windows OS and configure with PHP on XAMPP.
There are a couple of tutorials out there already, but neither of them helped me set everything up 100%. Some of them are missing key explanations, some of them are a bit old. My tutorial presumes you know your way around XAMPP on Windows and you have it installed already.
Here’s how to install MongoDB on your local Windows machine with XAMPP in 5 easy steps:
Step 1. Download mongo driver
To download mongo driver for Windows visit pecl.php.net
Download the latest stable release by clicking on the DLL link. I used the latest stable release at the time, 2017-05-04, version 1.2.9.

On the next page there is a DLL list. It is vital to pick the right version. You need to pick depending on three things:
- the PHP version that is installed with your XAMPP
- Architecture x86 or x64
- Whether Thread Safety is enabled or disabled
Here’s where to find out that information:
- Start XAMPP
- Navigate to the XAMPP dashboard via Internet browser (tipically at http://localhost)
- Click the PHPinfo in the top menu
- There, in the new tab you will see the table with the necessary information. At the top, you will see PHP version, in my case it was 7.0.13
Below that, in the table, you will see list of other information. You need to find the value for the Architecture (x86 or x64) and Thread Safety (enabled or disabled).
Finally, you can choose a proper DLL to download.
In my case, I had:
- PHP version 7.0.13
- Architecture x86
- Thread Safety enabled
When Thread Safety is enabled, you need to download Thread Safe (TS) version. So I downloaded file: 7.0 Thread Safe (TS) x86

Step 2. Unzip downloaded mongo driver version and copy .dll file to XAMPP
After successful download, unzip and find the .dll file. Copy it to ext directory of your XAMPP installation. If you installed XAMPP to C drive, full path to the ext folder would be C:\xampp\php\ext
Step 3. Register mongo .dll file within php.ini
Add following line into php.ini file:
extension=php_mongodb.dll
If your .dll file name is different, it’s ok, just make sure you call it like that within php.ini file. For example, if you added a file with a name of php_mongo.dll in the ext folder, you need to put that in the php.ini file.
Step 4. Restart XAMPP and refresh phpinfo.php page
When you restart XAMPP and refresh the phpinfo page, something like this should appear when you CTRL+F and type mongo:

If you don’t see that on your phpinfo page, you did something wrong so try to go back through previous steps.
Step 5. Install MongoDB on Windows
a) Download latest MongoDB server version.
b) Choose custom setup type and install in the C:\mongodb folder.
c) Then create db folder within data folder on the C drive – C:\data\db
d) Start MongoDB by executing the following command in the CMD: C:\mongodb\bin\mongod.exe
That is it, you successfully installed MongoDB on Windows and configured it in XAMPP!
Just in case you need extra help with step 5, here is the entire process explained with images.
Step 6. Download and install RoboMongo
As an extra step I would recommend installing MongoDB management tool, such as RoboMongo, (it’s called Robo 3T now) to easily manage MongoDB on your machine. Just create connection and you are set to go.
Conclusion and additional resources
Hope you found this tutorial useful in the process of installing and configuring MongoDB on your Windows machine with XAMPP.
For the next step, I recommend checking out the following MongoDB online courses on Pluralsight:
These fantastic courses by Nuri Halperin helped me to learn a lot more about MongoDB.
This is exactly what I’ve been looking for and worked like charm. Thank you very much.
Very good information… thanks for sharing.
Please update this.
Not working for me
Hi, thanks for the feedback, I will test it again as soon as I can, but if you have further info what exactly doesn’t work, please share. Thanks!
Hi, I am facing from some issue when i placed the extension=php_mongodb.dll in php.ini file. when i start apache after these editing my apache gives following error:
Status change detected: stopped
17:24:18 [Apache] Error: Apache shutdown unexpectedly.
17:24:18 [Apache] This may be due to a blocked port, missing dependencies,
17:24:18 [Apache] improper privileges, a crash, or a shutdown by another method.
17:24:18 [Apache] Press the Logs button to view error logs and check
17:24:18 [Apache] the Windows Event Viewer for more clues
17:24:18 [Apache] If you need more help, copy and post this
17:24:18 [Apache] entire log window on the forums
Can i know what is the solution for these issue. I can’t see list of extensions in php.ini.
Hi, did you copy the .dll file to C:\xampp\php\ext
I will try to update the article as soon as possible, as it might be outdated
For the ones having the Apache error that shuts down: try to use a different .dll, I tried with all the the fourth worked.
I was looking for quite a bit for something like this, and this worked perfectly. Thank you.
i have done all process as given in this documentation but still (Fatal error: Uncaught Error: Class ‘MongoDB\Driver\Manager’ not found ) error is commint
Hi, did you check phpinfo and can you confirm that class is being loaded? If that is true, could be that you need to call the MongoDB\Driver\Manager class in the global scope, like this: \MongoDB\Driver\Manager
when i am checking on browser my php info page so there is no any library showing of mongodb
ok so that means you didn’t install the mongo extension correctly, try to debug step by step
good, thanks you!
Thanks for information. I done installation successfully.