dongtiao0279 2016-06-21 13:18
浏览 70
已采纳

使用PHP7和Symfony3的MongoDB

I have a problem with MongoDB. I want install MongoDBBundle in my Symfony App but composer return an error:

Problem 1
- Installation request for doctrine/mongodb 1.4.x-dev -> satisfiable by doctrine/mongodb[1.4.x-dev].
- doctrine/mongodb 1.4.x-dev requires ext-mongo ^1.5 -> the requested PHP extension mongo is missing from your system.


 Problem 2
- doctrine/mongodb-odm 1.1.0 requires doctrine/mongodb ~1.3 -> satisfiable by doctrine/mongodb[1.3.x-dev, 1.4.x-dev].
- doctrine/mongodb-odm 1.0.0 requires doctrine/mongodb ~1.2 -> satisfiable by doctrine/mongodb[1.2.x-dev, 1.3.x-dev, 1.4.x-dev].
- doctrine/mongodb-odm 1.0.1 requires doctrine/mongodb ~1.2 -> satisfiable by doctrine/mongodb[1.2.x-dev, 1.3.x-dev, 1.4.x-dev].
- doctrine/mongodb-odm 1.0.2 requires doctrine/mongodb ~1.2 -> satisfiable by doctrine/mongodb[1.2.x-dev, 1.3.x-dev, 1.4.x-dev].
- doctrine/mongodb-odm 1.0.3 requires doctrine/mongodb ~1.2 -> satisfiable by doctrine/mongodb[1.2.x-dev, 1.3.x-dev, 1.4.x-dev].
- doctrine/mongodb-odm 1.0.4 requires doctrine/mongodb ~1.2 -> satisfiable by doctrine/mongodb[1.2.x-dev, 1.3.x-dev, 1.4.x-dev].
- doctrine/mongodb-odm 1.0.5 requires doctrine/mongodb ~1.2 -> satisfiable by doctrine/mongodb[1.2.x-dev, 1.3.x-dev, 1.4.x-dev].
- doctrine/mongodb-odm 1.0.6 requires doctrine/mongodb ~1.2 -> satisfiable by doctrine/mongodb[1.2.x-dev, 1.3.x-dev, 1.4.x-dev].
- doctrine/mongodb 1.3.x-dev requires ext-mongo ^1.5 -> the requested PHP extension mongo is missing from your system.
- doctrine/mongodb 1.2.x-dev requires ext-mongo ^1.2.12 -> the requested PHP extension mongo is missing from your system.
- doctrine/mongodb 1.4.x-dev requires ext-mongo ^1.5 -> the requested PHP extension mongo is missing from your system.
- Installation request for doctrine/mongodb-odm ~1.0 -> satisfiable by doctrine/mongodb-odm[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.1.0].
To enable extensions, verify that they are enabled in those .ini files:
- /etc/php/7.0/cli/php.ini
- /etc/php/7.0/cli/conf.d/10-mysqlnd.ini
- /etc/php/7.0/cli/conf.d/10-opcache.ini
- /etc/php/7.0/cli/conf.d/10-pdo.ini
- /etc/php/7.0/cli/conf.d/15-xml.ini
- /etc/php/7.0/cli/conf.d/20-apcu.ini
- /etc/php/7.0/cli/conf.d/20-apcu_bc.ini
- /etc/php/7.0/cli/conf.d/20-calendar.ini
- /etc/php/7.0/cli/conf.d/20-ctype.ini
- /etc/php/7.0/cli/conf.d/20-curl.ini
- /etc/php/7.0/cli/conf.d/20-dom.ini
- /etc/php/7.0/cli/conf.d/20-exif.ini
- /etc/php/7.0/cli/conf.d/20-fileinfo.ini
- /etc/php/7.0/cli/conf.d/20-ftp.ini
- /etc/php/7.0/cli/conf.d/20-gettext.ini
- /etc/php/7.0/cli/conf.d/20-iconv.ini
- /etc/php/7.0/cli/conf.d/20-intl.ini
- /etc/php/7.0/cli/conf.d/20-json.ini
- /etc/php/7.0/cli/conf.d/20-mcrypt.ini
- /etc/php/7.0/cli/conf.d/20-mongodb.ini
- /etc/php/7.0/cli/conf.d/20-mysqli.ini
- /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini
- /etc/php/7.0/cli/conf.d/20-phar.ini
- /etc/php/7.0/cli/conf.d/20-posix.ini
- /etc/php/7.0/cli/conf.d/20-readline.ini
- /etc/php/7.0/cli/conf.d/20-shmop.ini
- /etc/php/7.0/cli/conf.d/20-simplexml.ini
- /etc/php/7.0/cli/conf.d/20-sockets.ini
- /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.0/cli/conf.d/20-sysvsem.ini
- /etc/php/7.0/cli/conf.d/20-sysvshm.ini
- /etc/php/7.0/cli/conf.d/20-tokenizer.ini
- /etc/php/7.0/cli/conf.d/20-wddx.ini
- /etc/php/7.0/cli/conf.d/20-xdebug.ini
- /etc/php/7.0/cli/conf.d/20-xmlreader.ini
- /etc/php/7.0/cli/conf.d/20-xmlwriter.ini
- /etc/php/7.0/cli/conf.d/20-xsl.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

I don't understand this error because the extension MongoDB not missing. I have installed this extension with this command: pecl install mongodb

and when i list the php module load with php -m:

[PHP Modules]
apc
apcu
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gettext
hash
iconv
intl
json
libxml
mcrypt
mongodb
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xdebug
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zlib

I try this solution:

echo "extension=mongodb.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`

But it is not the solution.

Thank you for your help.

Thibault.

  • 写回答

3条回答 默认 最新

  • duanao3204 2016-06-21 13:44
    关注
    doctrine/mongodb 1.4.x-dev requires ext-mongo ^1.5
    

    ext-mongo is the legacy MongoDB driver (\MongoClient). ext-mongo was never ported to Zend 3 (PHP7). The new Mongo driver that does work under PHP7 (the one you installed via PECL) is ext-mongodb. This is not supported by the Doctrine driver for MongoDB.

    You have two choices: find a Doctrine driver that does work with the newer Mongo extension, or downgrade to PHP 5.6 and install ext-mongo.

    There is a currently open issue on support for the new extension.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 三极管电路求解,已知电阻电压和三级关放大倍数
  • ¥15 ADS时域 连续相位观察方法
  • ¥15 Opencv配置出错
  • ¥15 模电中二极管,三极管和电容的应用
  • ¥15 关于模型导入UNITY的.FBX: Check external application preferences.警告。
  • ¥15 气象网格数据与卫星轨道数据如何匹配
  • ¥100 java ee ssm项目 悬赏,感兴趣直接联系我
  • ¥15 微软账户问题不小心注销了好像
  • ¥15 x264库中预测模式字IPM、运动向量差MVD、量化后的DCT系数的位置
  • ¥15 curl 命令调用正常,程序调用报 java.net.ConnectException: connection refused