January 08, 2013

PHP MongoDB Driver not working!

In Semester 3 I have PHP unfortunately not MongoDB. So I was doing PHP practicals while I was doing my office things. So suddenly MongoDB came to my mind. Then I tried to connect to MongoDB with PHP. Although I have already tried with .NET. I never tried MongoDB with PHP. So I installed IIS 8.0 and PHP 5.3.1. 

Then I downloaded the driver from github. Extracted it to C:\Program Files (x86)\PHP\v5.3\ext\. 
I added the entry to php.ini properly. Then I restarted IIS using iisreset. But MongoDB Driver for PHP was not loaded properly. Then I was checking and doing so many things but nothing worked.

Try this way!

1. Download driver from github.

2. Extract zip file.

3. Copy php_mongo-1.3.2RC1-5.3-vc9-nts.dll to C:\Program Files (x86)\PHP\v5.3\ext\. And rename it to php_mongo.dll.

4. Then take properties of php_mongo.dll and unblock executable.
5. Then go to C:\Program Files (x86)\PHP\v5.3\ and open php.ini as Administrator and add below line to end of the file.


6. Then take a command prompt as administrator and run below command.


Enjoy MongoDB with PHP!


  1. You are a genius I was loading the wrong DLL


  2. • Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updatingAzure Online course Bangalore