mongodb php example
Example: connect mongodb with php
To use mongodb with php you have to use mongodb php driver. Kindly follow below to download the latest mongodb php driver.
https://s3.amazonaws.com/drivers.mongodb.org/php/index.html
After downloading unzip the file put php_mongo.dll into php extesion directory.
And add below line into your php.ini file
extension = php_mongo.dll
To test its working or not execute below line of code on browser
<?php
$m = new MongoClient();
echo "Connection to database successfully";
$db = $m->mydb;
echo "Database mydb selected";
?>