Prasanth Bendra
Prasanth Bendra

Reputation: 32820

mongo DB - php driver version

I am using XAMPP, PHP Version 5.3.5.

I installed mongodb.

I tried to connect mongo db from my php code, it gives me error

$connection = new MongoClient("mongodb://localhost");
$db = $connection->dbname;

echo $db;

Fatal error: Class 'MongoClient' not found in C:\xampp\htdocs\test\test.php on line 9

I guess it is because, I installed a old version of php-mongo driver.

What is the proper version of php-mongo driver for PHP Version 5.3.5 ?

Upvotes: 0

Views: 2794

Answers (1)

Anh Nhan Nguyen
Anh Nhan Nguyen

Reputation: 318

The current version of the MongoDB driver for PHP is 1.3.4.

The class Mongo was deprecated with version 1.3 and replaced with MongoClient. Apparently you are using an older version than 1.3 in your install.

http://pecl.php.net/package/mongo

Upvotes: 1

Related Questions