Reputation: 1
Fatal error:
Class 'Mongo' not found in C:\Apache Software Foundation\Apache2.2\htdocs\sample\testdb.php
Can anyone help me out with this issue? Why is that saying so?
The following is the code that I have used. I have created a database named phptest
in MongoDB and inserted a document. Then I tried connecting to MongoDB via PHP but it threw this error.
Can anyone help me get rid of this? I have included the php-mongo dll and saved in php.ini file also.
<?php
echo "succeeded!";
$connection = new Mongo();
$db = $connection->test;
$collection = $db->phptest;
?>
Upvotes: 0
Views: 2977
Reputation: 2112
You're probably using an older version of the Mongo DB driver. The class Mongo
has been replaced with MongoClient
, since v 1.3.0 of the driver. See this stackoverflow thread :
Upvotes: 0
Reputation: 11
Make sure you have the correct php driver installed.
For example if "Thread Safety" is enabled in your php.ini, then make sure you have the "Thread-Safe Mongo Extension" installed and NOT the "Non-Thread-Safe" version.
Upvotes: 1