谁一开始就是大神?

安装MongoDB扩展一直能成功[2.0]

这几天一直未能 安装成功 MongoDB 扩展

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
    - yiisoft/yii2-mongodb 2.1.1 requires ext-mongodb >=1.0.0 -> the requested P
HP extension mongodb is missing from your system.
    - yiisoft/yii2-mongodb 2.1.0 requires ext-mongodb >=1.0.0 -> the requested P
HP extension mongodb is missing from your system.
    - Installation request for yiisoft/yii2-mongodb ~2.1.0 -> satisfiable by yii
soft/yii2-mongodb[2.1.0, 2.1.1].

  To enable extensions, verify that they are enabled in those .ini files:
    - D:\wamp64\bin\php\php5.6.25\php.ini
  You can also run `php --ini` inside terminal to see which files are used by PH
P in CLI mode.
`

Compiler	MSVC11 (Visual C++ 2012)
mongo

MongoDB Support	enabled
Version	1.6.8
Streams Support	enabled
Supported Authentication Mechanisms
MONGODB-CR	enabled
SCRAM-SHA-1	enabled
MONGODB-X509	disabled
GSSAPI (Kerberos)	enabled
PLAIN	enabled
Directive	Local Value	Master Value
mongo.allow_empty_keys	0	0
mongo.chunk_size	261120	261120
mongo.cmd	$	$
mongo.default_host	localhost	localhost
mongo.default_port	27017	27017
mongo.is_master_interval	15	15
mongo.long_as_object	0	0
mongo.native_long	0	0
mongo.ping_interval	5	5

骚年,mongo扩展最新版本是2.1,是需要php7支持的,如果你php版本低于7.0,就在composer.json加个`
然后php composer update下。用2.0版本的。
[备注] 我这个问题回答不清晰,我自己基于当时使用的是php7版本,php-mongo扩展已经不支持,所以我换成了php-mongodb扩展,但是我没有回退,所以不清楚php-mongodb是否支持低版本。这个问题回答错误,如果给大家造成不便的话非常抱歉。多谢勇哥@xiaoshenzhen指出我的错误。
引用勇哥的注解:
mongo的扩展(胖子这里说的是Yii2 mongodb扩展,不是php的mongodb扩展)最新版本是2.1, 这个扩展需要php-mongodb扩展支持 php-mongodb在php5和php7下面都是可以运行的,我测试过,一点问题也没有。
yii2-mongodb 有一个1版本,这个1版本对应的是php-mongo扩展,因此只能在php5下面跑,不支持php7
yii2-mongodb 有一个2版本,这个2版本对应的是php-mongodb扩展,因此支持php5和php7

赞(0) 打赏
未经允许不得转载:菜鸟之家 » 安装MongoDB扩展一直能成功[2.0]

评论 抢沙发

登录

找回密码

注册