Install MongoDB with Windows XAMPP
Blogs20122012-06-04
Install MongoDB with Windows XAMPP
I found a useful article How to install MongoDB to use with XAMPP on Windows when I struggled with the correct version of php_mongo.dll.
Step1
Installing MongoDB
- Download MongoDB from http://www.mongodb.org/downloads
- Extract the archive
- Open Command Prompt
- Goto mongodbbin folder
- Type to create DB repository and start daemon:
mkdir C:mongodbdb
mongod.exe --dbpath=C:mongodbdbStep2
Check your Php version by going to http://localhost/xampp/phpinfo.php
note down the following from the below image
first the php version(here 5.3) then the php extension build (here ts,vc6)
- Download MongoDB driver from github.com/mongodb/mongo-php-driver/downloads
- Extract driver and copy the dll that matches your php version installed on your xampp (here mongo-1.1.4-php5.3vc6ts) and put to php/ext folder
- Open php.ini file
- Append this extension=php_mongo.dll, save php.ini file, and then restart your web server.
if every thing went fine thenÂ
- Point your browser at localhost and select your language, then phpinfo() from the left menu
- Make sure there’s a Mongo section
The core is the ’PHP Extension Build: API20090626,TS,VC6’ option in localhost/xampp/phpinfo.php, the ’TS,VC6’ here is important for download correct php_mongo.dll version, others corrupt.
Step 3
Try out this example from here http://www.php.net/manual/en/mongo.tutorial.php to test mongodb is working
