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 ?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.