php70-mongo install doctrine/mongodb-odm fails

deroccha picture deroccha · May 2, 2016 · Viewed 12k times · Source

I try to install doctrine/mongodb-odm[1.0.5] over composer but drops me

  Problem 1
    - doctrine/mongodb 1.3.0 requires ext-mongo ^1.5 -> the requested PHP extension mongo is missing from your system.
    - doctrine/mongodb 1.2.2 requires ext-mongo ^1.2.12 -> the requested PHP extension mongo is missing from your system.
    - doctrine/mongodb 1.2.1 requires ext-mongo ^1.2.12 -> the requested PHP extension mongo is missing from your system.
    - doctrine/mongodb 1.2.0 requires ext-mongo ^1.2.12 -> the requested PHP extension mongo is missing from your system.
    - doctrine/mongodb-odm 1.0.5 requires doctrine/mongodb ~1.2 -> satisfiable by doctrine/mongodb[1.2.0, 1.2.1, 1.2.2, 1.3.0].
    - Installation request for doctrine/mongodb-odm ~1.0.5 -> satisfiable by doctrine/mongodb-odm[1.0.5].

mongo extension is already installed

php -i | grep mongo

/usr/local/etc/php/7.0/conf.d/ext-mongodb.ini
mongodb
mongodb support => enabled
mongodb version => 1.1.6
mongodb stability => stable
libmongoc version => 1.3.5
mongodb.debug => no value => no value

what went wrong in this case?

Answer

malcolm picture malcolm · May 2, 2016

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.