IAddBugsToCodebases
IAddBugsToCodebases

Reputation: 525

Symfony cannot load mongodb/driver

I'm trying to implement doctrine ODM. I'm taking baby steps but I keep hitting roadblocks. This is one of the many roadblocks so far:

PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "Manager" from namespace "MongoDB\Driver".

When I do this:

use MongoDB\Driver\Manager;    
$manager = new Manager("mongodb://10.0.2.2:27017");
$servers = $manager->getServers();
var_dump($servers);

I'm requiring

"alcaeus/mongo-php-adapter": "^1.0",

which in turns require

"mongodb/mongodb": "^1.0.1"

Is there something I'm missing or that I'm not getting about the whole setup?

Upvotes: 1

Views: 3518

Answers (1)

IAddBugsToCodebases
IAddBugsToCodebases

Reputation: 525

Mongo was not installed.

To install mongodb

pecl install mongodb

When you have mongodb installed

php -m | grep -i mongo

Should output:

mongodb

Thanks Simon.

Upvotes: 2

Related Questions