Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composer - Unable to install mongodb/mongodb on Windows

I'm trying to install the following package on my Laravel installation using composer : jenssegers/mongodb

But when installing, I'm getting the following error :

- 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].

The extension is actually listed when I run composer show -p like that :

ext-mongo           1.6.12   The mongo PHP extension

and it's also enabled correctly when I do php_info() or anything.

I'm also sure that I enabled it in the correct php.ini file.

Actually, I guess that the problem comes from the fact that it should be called mongodb instead of mongo.

Is their any fix for this for Windows ?

Thanks.

like image 904
AntoineB Avatar asked Mar 14 '16 18:03

AntoineB


2 Answers

Okay, so it seems like I was installing the old legacy driver which is not supported.

To clarify things up, there's two available drivers for MongoDB for PHP :

  • The legacy one, available here : https://pecl.php.net/package/mongo
  • The most recent one, available here : https://pecl.php.net/package/mongodb

The legacy driver will be identified as mongo by PHP, while the new one is correctly identified as mongodb.

like image 67
AntoineB Avatar answered Nov 15 '22 05:11

AntoineB


I had the same issue and after searching for a while, i can across this solution:

composer require jenssegers/mongodb --ignore-platform-reqs

This ignores all platform requirements and 'force' installs.

Source: Composer can't find mongodb extension

like image 42
imbayago Avatar answered Nov 15 '22 03:11

imbayago