试图通过Composer安装doctrine/mongodb-odm我得到这个:
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.
然而php -m
有:
[PHP Modules]
...
mongo
...
, composer.phar show --platform
有:
...
ext-mongo 1.3.5 The mongo PHP extension
...
任何想法?扩展肯定是正确安装的,Composer甚至列出了它。版本(>=1.2.12,<1.4-dev)也满足要求。
原来这是Sublime Text 2 Composer插件的错误。如果我通过终端运行作曲器,没问题。为什么它不工作在ST2有点神秘,虽然,据我所知,它执行完全相同的命令:/bin/composer.phar update -n -v
.
如果您将Mongo加载到通过WAMPSERVER安装的PHP实例中,则可能导致此问题的原因是两个PHP .ini文件中只有一个被修改了pathtowampbinphpphp5php.ini
。如果您将extension=php_mongo.dll
添加到pathtowampbinapacheapche2binphp.ini
,您应该能够从命令行或编辑器cli工具中使用mongo函数执行php。
如果你遇到作曲错误:
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
那么这是另一个指示你需要更新apache2xbinphp.ini
文件