laravel-mongodb: Composer can't find mongodb extension

Hi - I’m running into essentially the same error as in issue #780 when executing composer require jenssegers/mongodb:

$ composer require jenssegers/mongodb
Using version ^3.0 for jenssegers/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
    - jenssegers/mongodb v3.0.0 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1].
    - jenssegers/mongodb v3.0.1 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1].
    - jenssegers/mongodb v3.0.2 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1].
    - mongodb/mongodb 1.0.1 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system.
    - mongodb/mongodb 1.0.0 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system.
    - Installation request for jenssegers/mongodb ^3.0 -> satisfiable by jenssegers/mongodb[v3.0.0, v3.0.1, v3.0.2].

  To enable extensions, verify that they are enabled in those .ini files:
    - C:\Program Files\PHP\v7.0\php.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’m running Windows 10 and PHP 7. I installed the mongodb extension (php_mongodb.dll in PHP ext/ folder), and I’ve updated php.ini with extension=php_mongodb.dll. Not sure what I’ve missed. If anyone can help me with this, I’d greatly appreciate it. Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 40 (1 by maintainers)

Most upvoted comments

composer require jenssegers/mongodb --ignore-platform-reqs It solved my problem.

Or another thing - pecl installing mongodb.so (if we talking about *nix OSes) but putting to mongo.ini: extension=mongo.so but have to extension=mongodb.so If you fix this string at: /etc/php5/mods-available/mongo.ini all have to be ok. Please, ping me if it fix.

@Criscros, try to look:

  1. php -m to see than extenstsion is installed
  2. php -i | grep mongo will show you where mongodb ini file located
  3. change extension=mongo.so if exists to extension=mongodb.so

I executed following commands in order (ubuntu 16.04) (php 7.2)

sudo apt-get install php-mongodb

composer require mongodb/mongodb

composer require jenssegers/mongodb

This worked for me…

sudo pecl install mongodb sudo nano /etc/php5/mods-available/mongodb.ini insert in file extension=mongodb.so sudo ln -sv /etc/php5/mods-available/mongodb.ini /etc/php5/apache2/conf.d/20-mongodb.ini sudo ln -sv /etc/php5/mods-available/mongodb.ini /etc/php5/cli/conf.d/20-mongodb.ini sudo service apache2 restart composer require jenssegers/mongodb

I just needed to install the php driver for mongo

brew install php56-mongodb

try this composer install --ignore-platform-reqs

Make sure mongodb version/type is correct I use this

sudo yum install -y openssl-devel
sudo yum install pecl
sudo yum install gcc
sudo pecl install mongodb

Try installing the mongodb extension using homebrew. Change this commands to your php version.

$ brew tap homebrew/php $ brew install php56-mongodb

Then link it to your php.ini

extension=‘/usr/local/opt/php56-mongodb/mongodb.so’

composer require jenssegers/mongodb --ignore-platform-reqs It solved my problem.

This doesn’t work on Laravel 7

Use alpha release v4

composer require jenssegers/mongodb --ignore-platform-reqs It solved my problem.

composer update --ignore-platform-reqs

I’m using php 5.6, so it helped me

sudo apt-get install -y php-pear php5.6-dev sudo pecl install mongo

sudo sh -c “echo ‘extension=mongo.so’ > /etc/php/5.6/mods-available/mongo.ini” sudo ln -s /etc/php/5.6/mods-available/mongo.ini /etc/php/5.6/apache2/conf.d/mongo.ini

sudo service apache2 restart

Thank you all: @Siphion01 and @supaheckafresh. It’s pleasure for me to be helpful.

Have the same problem but on Ubuntu (Homestead). At searching…