Symfony cannot load mongodb/driver

3.4k views Asked by At

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?

1

There are 1 answers

0
Bernardo On BEST ANSWER

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.