php70-mongo install doctrine/mongodb-odm fails php70-mongo install doctrine/mongodb-odm fails symfony symfony

php70-mongo install doctrine/mongodb-odm fails


On PHP7 you have mongodb extension as @xaben mentioned. You can use this with doctrine until it support mongodb but by installing additional library https://github.com/alcaeus/mongo-php-adapter

First install via composer:

composer require alcaeus/mongo-php-adapter

and later install doctrine. It's works very well in my case.


PHP has 2 extensions for MongoDB:

  1. The legacy one found at http://php.net/manual/en/book.mongo.php
  2. The current one http://php.net/manual/en/set.mongodb.php

In case of "doctrine/mongodb-odm" it expects to find the legacy one "mongo" but what you have installed is the newer one "mongodb".

In order to use the legacy extension you need to use php <= 5.6, for php 7 only mongodb is available.


I had the problem , but install and config symfony 3.1 with php 5.6 and mysql , After need installer mongodb, so udpate 7.1

problem composer.json :

"config": {    "platform": {"php": "5.6"}}

Change:

"config": {    "platform": {"php": "7.1"}}