Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php70-mongo install doctrine/mongodb-odm fails

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?

like image 312
deroccha Avatar asked May 02 '16 14:05

deroccha


2 Answers

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.

like image 84
malcolm Avatar answered Nov 16 '22 00:11

malcolm


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.

like image 6
xaben Avatar answered Nov 16 '22 02:11

xaben