Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does composer complain about the ext-mongo extension?

When I try to install doctrine/mongodb-odm-bundle and doctrine/mongodb with composer it throws an error.

composer require doctrine/mongodb-odm-bundle doctrine/mongodb
Using version ^3.5 for doctrine/mongodb-odm-bundle
Using version ^1.6 for doctrine/mongodb
./composer.json has been updated
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 1.6.3 requires ext-mongo ^1.6.7 -> the requested PHP extension mongo is missing from your system.
    - doctrine/mongodb 1.6.2 requires ext-mongo ^1.6.7 -> the requested PHP extension mongo is missing from your system.
    - 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.
    - Installation request for doctrine/mongodb ^1.6 -> satisfiable by doctrine/mongodb[1.6.0, 1.6.1, 1.6.2, 1.6.3].

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

Installation failed, reverting ./composer.json to its original content.

I was suprised to see this error message because I did install Mongodb with pecl and enabled it with an ini file.

RUN pecl install mongodb \
    && docker-php-ext-enable mongodb

Does anyone knows how to solve this?

like image 541
JoeriV Avatar asked Dec 06 '22 10:12

JoeriV


1 Answers

I figured that by adding a provide section with the ext-mongo to the composer.json file the issue was resolved

"provide" : {
    "ext-mongo": "*"
}

It appears to completely ignore the php extension.

like image 93
JoeriV Avatar answered Dec 09 '22 03:12

JoeriV