loading...

Monday, March 7, 2011

How to install MongoDB to use with xampp on Windows

MongoDB is a NOSQL,schema-free and document-oriented database which is a good alternative to couchDB and MYSQL used extensively for high scalability and performance here you could find a list of website uses mongodb as there database
  1. Foursquare
  2. bit.ly
  3. SourceForge
  4. Github
Today i am going to tell How to install MongoDB to use with xampp on Windows where you could play around with php

Step1
Installing MongoDB

  1. Download MongoDB from mongodb.org/display/DOCS/Downloads
  2. Extract the archive
  3. Open Command Prompt
  4. Goto mongodb\bin folder
  5. Type
mkdir C:\mongodb\db
mongod.exe --dbpath=C:\mongodb\db

Step2
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)
  1. Download MongoDB driver from github.com/mongodb/mongo-php-driver/downloads
  2. 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
  3. Open php.ini file
  4. Append this extension=php_mongo.dll, save php.ini file, and then restart your web server.
if every thing went fine then 
  1. Point your browser at localhost and select your language, then phpinfo() from the left menu
  2. Make sure there's a Mongo section
try out this example from here http://www.php.net/manual/en/mongo.tutorial.php to test mongodb is working

7 comments:

  1. hi rajesh
    am using win7 and but it showing warning
    PHP startup:mongo: Unable to initialize module
    Module compiled with module API=10060613
    PHP compiked with module API=20090626
    These options need to match

    So it not working in my system
    am currenlty using PHP 5.3.5
    Please give the solution
    thanks

    ReplyDelete
  2. PHP startup:mongo: Unable to initialize module
    Module compiled with module API=10060613
    PHP compiked with module API=20090626
    These options need to match

    So it not working in my system
    am currenlty using PHP 5.3.5
    Please give the solution


    Any reply on this same problem for me :)

    ReplyDelete
  3. Install the correct driver, looks like there was a problem with the driver you installed

    I choose mongo-1.1.4.zip — All of the Windows build for the 1.1.4 release -- updated #2 it only contained php_mongo.dll which is what we need.

    ReplyDelete
  4. Thanks Katie. I had installed all the latest versions without noticing that the VC number had anything to do with the php version. Silly of me:)

    ReplyDelete
    Replies
    1. Yes Katie you are correct that "1.1.4 release -- updated #2" is the driver file to be downloaded. Thanks:)

      Delete
  5. Thanks Rajesh your phpinfo image display helped me a lot to install the mongodb in wamp/xampp

    ReplyDelete
  6. Hi..I tried all the steps that you have mentioned and still I am unable to use mongoDB in xampp...The PHPinfo does not show mongodb details...But i have followed all the steps that you have mentioned..Please help me with a solution..

    ReplyDelete

fuzionpro Headline

fuzionpro