I am using windows 10 64 bit, xampp 3.2.2, PHP 5.6.30, PHP Extension Build VC11, MongoDB server version: 3.4.3.
I am getting error like "Fatal error: Class 'MongoClient' not found in D:\xampp\htdocs\test\test1.php on line 4".
Here is the code I am using
CODE
<?php
// connect
$m = new MongoClient();
// select a database
$db = $m->cabin;
// select a collection (analogous to a relational database's table)
$collection = $db->user;
// find everything in the collection
$cursor = $collection->find();
// iterate through the results
foreach ($cursor as $document) {
echo $document["title"] . "
";
}
?>
I have added dll file in folder (D:\xampp\php\ext)
and added extension in php.ini (D:\xampp\php)
"extension=php_mongodb.dll". But issue is not solved.
MongoDB (Mongo db is working)
user@DESKTOP-JCDJQ65 MINGW64 /d
$ mongo
MongoDB shell version v3.4.3
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.3
use cabin
switched to db cabin
show tables
bmessages
booking
cabins
club
country
customer
email
facilities
land
mschool
region
role
rooms
settings
tempuser
tour
user
userold
visit