doctrine/mongodb

Installing doctrine/mongodb on PHP7.1

Closed this issue · 3 comments

Hello,

I'm trying to install the package in my project with (PHP 7.1 on MacOSX with brew package manager).
I get an error about version of mongo library.
doctrine/mongodb requires mongo 1.6.7 which is not in brew. (only newer mongodb-1.3.3 is available there).
So I tried to install mongo ext with pecl, unfortunatelly:
pecl/mongo requires PHP (version >= 5.3.0, version <= 5.99.99), installed version is 7.1.11.

Do I understand this correctly that I can't use doctrine/mongodbin my procject with current PHP version?
Or is there a way to bypass this?

Full error here:

Using version ^3.4 for doctrine/mongodb-odm-bundle
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - doctrine/mongodb-odm-bundle 3.4.0 requires doctrine/mongodb ^1.4 -> satisfiable by doctrine/mongodb[1.4.0, 1.5.0, 1.6.0, 1.6.1].
    - doctrine/mongodb-odm-bundle 3.4.1 requires doctrine/mongodb ^1.4 -> satisfiable by doctrine/mongodb[1.4.0, 1.5.0, 1.6.0, 1.6.1].
    - doctrine/mongodb 1.6.1 requires ext-mongo ^1.6.7 -> the requested PHP extension mongo is missing from your system.
    - doctrine/mongodb 1.6.0 requires ext-mongo ^1.6.7 -> the requested PHP extension mongo is missing from your system.
    - doctrine/mongodb 1.5.0 requires ext-mongo ^1.5 -> the requested PHP extension mongo is missing from your system.
    - doctrine/mongodb 1.4.0 requires ext-mongo ^1.5 -> the requested PHP extension mongo is missing from your system.
    - Installation request for doctrine/mongodb-odm-bundle ^3.4 -> satisfiable by doctrine/mongodb-odm-bundle[3.4.0, 3.4.1].

  To enable extensions, verify that they are enabled in your .ini files:
    - /usr/local/etc/php/7.1/php.ini
    - /usr/local/etc/php/7.1/conf.d/ext-mongodb.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

We don't have specific documentation for this bundle, but the ODM docs have a section for installing on PHP 7. Note that these are a bit out of date and the recommended procedure to solve this is to run the following command:
composer config "platform.ext-mongo" "1.6.16" && composer require alcaeus/mongo-php-adapter

I'll make sure to update the ODM docs and add a more visible chapter to the Symfony documentation for the bundle.

From what I see the documentation was updated so I'm closing this :)

The Documentation need to be updated again for new symfony version 4.2 .
There is no folder called App now and AppKernel.php renamed to Kernel.php and this generate example etc.
Also mention this PHP 7 fix composer config "platform.ext-mongo" "1.6.16" && composer require alcaeus/mongo-php-adapter in new documentation so Devs following the Docs do not have to search this place.

For one, this library has nothing to do with Symfony, only the bundle for mongodb-odm does. Furthermore, this library is no longer maintained; it is considered legacy for usage with mongodb-odm only. Its documentation specifies more than enough info how to use it with PHP 7 and if you’re not using ODM, you should no longer rely on this library.

Last but not least, don’t resurface old issues; please create a new one instead. Thanks!