我尝试在作曲家上安装doctrine / 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
在这种情况下出了什么问题?
答案 0 :(得分:32)
在PHP7上,你提到mongodb
扩展名为@xaben。您可以将其与doctrine一起使用,直到它支持mongodb
,但通过安装其他库https://github.com/alcaeus/mongo-php-adapter
首先通过composer安装:
composer require alcaeus/mongo-php-adapter
以后安装学说。在我的情况下,它的效果非常好。
答案 1 :(得分:6)
PHP有两个MongoDB扩展:
如果是" doctrine / mongodb-odm"它希望找到传统的一个" mongo"但你安装的是较新的" mongodb"。
为了使用旧版扩展,你需要使用php< = 5.6,对于php 7,只有mongodb可用。
答案 2 :(得分:0)
我遇到了问题,但安装和配置symfony 3.1与php 5.6和mysql,之后需要安装程序mongodb,所以udpate 7.1
问题composer.json:
"config": {
"platform": {"php": "5.6"}
}
变化:
"config": {
"platform": {"php": "7.1"}
}