How to connect MongoDB using PHP

After posting content about MongoDB, just thinking of posting another content about MongoDB but with PHP. Yes this post about connecting MongoDB with PHP,  if your are using Windows OS you can check with below link about MongoDB installations & enable extension in Wamp Server.

Before starting up our tutorial let’s check MongoDB is running status by executing simple script to check in PHP.

MongoClient is used to create and manage the connections between PHP and MongoDB.

<?php
$con = new MongoClient( "mongodb://127.0.0.1:27017" );

Let’s  create simple  feedback form to add and show the data from MongoDB. first create demo database.  You no need to create collection because when you do the first insert collection will automatically created and insert the data into it. Continue reading

How to enable MongoDB extension in WampServer

This post will teach about how to enable MongoDB extension in WampServer for PHP 5.5.12 version. If you have not installed MongoDB in your system you can check this post Installing MongoDB in Windows OS.

List of things need to installed before enabling MongoDB in WampServer.

  1. WampServer 2.5
  2. MongoDB 3.0
Wamp Server 2.5

Wamp Server 2.5

If everything is installed, then we will download MongoDB driver from https://s3.amazonaws.com/drivers.mongodb.org/php/index.html for PHP 5.5.12 version now we have to download php_mongo-1.5.5.zip from the website. Continue reading

Installing MongoDB in Windows OS

MongoDB is a cross-platform document-oriented database which store data in json structure key pair value. It’s easy to integration data.

But we are going to see about installing MongoDB in Windows OS.  MongoDB support four Operting System Windows, Linux, Mac OS X and Solaris. Also you can download Current, Previous and Development release.MongoDB_Logo

https://www.mongodb.org/downloads

We are going to download Product Release (3.0.1), select “Windows 64-bit 2008 R2″ version and download it.  Once you downloaded the MongoDB version run it and follow the steps. Continue reading