Howto Start MongoDB and Enable php_mongo in WAMP

Start MongoDB

WampDeveloper comes with MongoDB located in folder:
C:\WampDeveloper\Tools\mongodb

MongoDB can either be started:

A) Manually from the command-line:

mongod --config C:\WampDeveloper\Tools\mongodb\mongodb.conf

B) Or by double-clicking entry “MongoDB” in WampDeveloper’s Applications Tab, in which case, WampDeveloper will run file:
C:\WampDeveloper\Resources\run\tools.mongodb.start.bat

The MongoDB server will run as long as the command-line window is open.

Enable php_mongo

To connect and talk to the MongoDB server via PHP code, PHP extension php_mongo must be loaded.

1. Edit file:
C:\WampDeveloper\Config\Php\php.ini

2. Uncomment section:

[Mongo]
extension=php_mongo.dll
mongo.allow_empty_keys=0
mongo.chunk_size=262144
mongo.cmd="$"
mongo.default_host="127.0.0.1"
mongo.default_port="27017"
mongo.is_master_interval=15
mongo.long_as_object=0
mongo.native_long=0
mongo.ping_interval=5

(* uncomment by removing “;”, section is located near end of file)

3. Save file and restart Apache.

Connecting To and Using MongoDB

A REST interface to some MongoDB stats and information is provided on URL:
http://127.0.0.1:28017/

Example PHP code to test the operations of the MongoDB server is provided here:
http://blog.mongodb.org/post/24960636131/mongodb-for-the-php-mind-part-1

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>