我试图在composer上安装条令/mongodb-odm[1.0.5],但放弃了
Problem 1
- doctrine/mongodb 1.3.0 requires ext-mongo ^1.5 -> the requested PHP extension mongo is missing from your system.
- doctrine/mongodb 1.2.2 requires ext-mongo ^1.2.12 -> the requested PHP extension mongo is missing from your system.
- doctrine/mongodb 1.2.1 requires ext-mongo ^1.2.12 -> the requested PHP extension mongo is missing from your system.
- doctrine/mongodb 1.2.0 requires ext-mongo ^1.2.12 -> the requested PHP extension mongo is missing from your system.
- doctrine/mongodb-odm 1.0.5 requires doctrine/mongodb ~1.2 -> satisfiable by doctrine/mongodb[1.2.0, 1.2.1, 1.2.2, 1.3.0].
- Installation request for doctrine/mongodb-odm ~1.0.5 -> satisfiable by doctrine/mongodb-odm[1.0.5].
mongo扩展已经安装
php -i | grep mongo
/usr/local/etc/php/7.0/conf.d/ext-mongodb.ini
mongodb
mongodb support => enabled
mongodb version => 1.1.6
mongodb stability => stable
libmongoc version => 1.3.5
mongodb.debug => no value => no value
这个案子出了什么问题?
在PHP7上,您有@xaben提到的mongodb
扩展。您可以将其与条令一起使用,直到它支持mongodb
,但需要安装额外的库https://github.com/alcaeus/mongo-php-adapter
通过composer:首次安装
composer require alcaeus/mongo-php-adapter
后来建立了学说。它在我的情况下运行得很好。
PHP有两个MongoDB扩展:
- 在中找到的遗留问题http://php.net/manual/en/book.mongo.php
- 当前的http://php.net/manual/en/set.mongodb.php
在"条令/mongodb-odm"的情况下,它希望找到旧的"mongo",但您安装的是新的"mongodb"。
为了使用遗留扩展,您需要使用php<=5.6,对于php7,只有mongodb可用。
我有这个问题,但用php5.6和mysql安装和配置symfony3.1,之后需要安装程序mongodb,所以udpate7.1
问题组合器.json:
"config": {
"platform": {"php": "5.6"}
}
更改:
"config": {
"platform": {"php": "7.1"}
}