无法使用Composer安装doctrine / mongodb-odm

无法使用Composer安装doctrine / mongodb-odm

问题描述:

Trying to install doctrine/mongodb-odm via Composer I get this:

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.0.x-dev requires ext-mongo >=1.2.12,<1.4-dev -> the requested PHP extension mongo is missing from your system.
    - doctrine/mongodb 1.0.2 requires ext-mongo >=1.2.12,<1.4-dev -> the requested PHP extension mongo is missing from your system.
    - doctrine/mongodb 1.0.1 requires ext-mongo >=1.2.12,<1.4-dev -> the requested PHP extension mongo is missing from your system.
    - doctrine/mongodb 1.0.0-BETA3 requires ext-mongo >=1.3.1,<1.4-dev -> the requested PHP extension mongo is missing from your system.
    - doctrine/mongodb 1.0.0-BETA2 requires ext-mongo >=1.2.12,<1.3-dev -> the requested PHP extension mongo is missing from your system.
    - doctrine/mongodb 1.0.0-BETA1 requires ext-mongo * -> the requested PHP extension mongo is missing from your system.
    - doctrine/mongodb 1.0.0 requires ext-mongo >=1.2.12,<1.4-dev -> the requested PHP extension mongo is missing from your system.
    - Installation request for doctrine/mongodb 1.0.*@dev -> satisfiable by doctrine/mongodb 1.0.0, doctrine/mongodb 1.0.0-BETA1, doctrine/mongodb 1.0.0-BETA2, doctrine/mongodb 1.0.0-BETA3, doctrine/mongodb 1.0.1, doctrine/mongodb 1.0.2, doctrine/mongodb 1.0.x-dev.

However php -m has:

[PHP Modules]
...
mongo
...

And composer.phar show --platform has:

...
ext-mongo        1.3.5     The mongo PHP extension
...

Any ideas? The extension is definitely installed correctly, and Composer even lists it. The version (>=1.2.12,<1.4-dev) meets the requirements as well.

尝试通过Composer安装doctrine / mongodb-odm我得到了这个: p>

 使用包信息加载编写器存储库
更新依赖项(包括require-dev)
您的需求无法解析为可安装的软件包集。
 
问题1 
  -  doctrine / mongodb 1.0.x-dev 需要ext-mongo&gt; = 1.2.12,&lt; 1.4-dev  - &gt; 您的系统中缺少所请求的PHP扩展名mongo。
  -  doctrine / mongodb 1.0.2需要ext-mongo&gt; = 1.2.12,&lt; 1.4-dev  - &gt; 您的系统中缺少所请求的PHP扩展名mongo。
  -  doctrine / mongodb 1.0.1需要ext-mongo&gt; = 1.2.12,&lt; 1.4-dev  - &gt; 您的系统中缺少所请求的PHP扩展名mongo。
  -  doctrine / mongodb 1.0.0-BETA3需要ext-mongo&gt; = 1.3.1,&lt; 1.4-dev  - &gt; 您的系统中缺少所请求的PHP扩展名mongo。
  -  doctrine / mongodb 1.0.0-BETA2需要ext-mongo&gt; = 1.2.12,&lt; 1.3-dev  - &gt; 您的系统中缺少所请求的PHP扩展名mongo。
  -  doctrine / mongodb 1.0.0-BETA1需要ext-mongo *  - &gt; 您的系统中缺少所请求的PHP扩展名mongo。
  -  doctrine / mongodb 1.0.0需要ext-mongo&gt; = 1.2.12,&lt; 1.4-dev  - &gt; 您的系统中缺少所请求的PHP扩展名mongo。
  -  doctrine / mongodb的安装请求1.0.*@dev  - &gt; 可以理解为doctrine / mongodb 1.0.0,doctrine / mongodb 1.0.0-BETA1,doctrine / mongodb 1.0.0-BETA2,doctrine / mongodb 1.0.0-BETA3,doctrine / mongodb 1.0.1,doctrine / mongodb 1.0.2,  doctrine / mongodb 1.0.x-dev。
  code>  pre> 
 
 

php -m code>有: p>

   [PHP Modules] 
 ... 
mongo 
 ... 
  code>  pre> 
 
 

composer.phar show --platform code > has: p>

  ... 
ext-mongo 1.3.5 mongo PHP扩展程序
 ... 
  code>  pre> 
 
  

有什么想法吗? 扩展名肯定是正确安装的,Composer甚至会列出它。 版本(&gt; = 1.2.12,&lt; 1.4-dev)也符合要求。 p> div>

Turns out this was the fault of the Sublime Text 2 Composer plugin. If I run Coomposer via Terminal it's fine. Why it doesn't work in ST2 is a bit of a mystery though, as far as I can tell it's executing exactly the same command: /bin/composer.phar update -n -v.

If you loaded Mongo into an instance of PHP installed via WAMPSERVER, a likely cause for this issue is that only one of the 2 php.ini files was modified path\to\wamp\bin\php\php5\php.ini. If you add the extension=php_mongo.dll to the path\to\wamp\bin\apache\apche2\bin\php.ini you should be able to execute php with mongo functions from the command line or editer cli tools.

If you run into composer error:

doctrine/mongodb 1.0.x-dev requires ext-mongo >=1.2.12,<1.5-dev -> the requested PHP extension mongo is missing from your system

then it's another indicator you need to update the apache2x\bin\php.ini file