Php 需要ext mongodb ^1.5.0 symfony
我安装了extmongodb php——ri mongodb | grep版本 当我安装composer时,我与composer有问题Php 需要ext mongodb ^1.5.0 symfony,php,mongodb,symfony,Php,Mongodb,Symfony,我安装了extmongodb php——ri mongodb | grep版本 当我安装composer时,我与composer有问题 - mongodb/mongodb 1.4.0 requires ext-mongodb ^1.5.0 -> the requested PHP extension mongodb is missing from your system. - mongodb/mongodb 1.3.2 requires ext-mongodb ^1.4.0 -> t
- mongodb/mongodb 1.4.0 requires ext-mongodb ^1.5.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.3.2 requires ext-mongodb ^1.4.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.3.1 requires ext-mongodb ^1.4.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.3.0 requires ext-mongodb ^1.4.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.4.0 requires ext-mongodb ^1.5.0 -> the requested PHP extension mongodb is missing from your system.
我的php信息(更多详细信息)
如果我尝试使用composer安装mongodb
composer需要mongodb/mongodb
我有这个错误
如果我使用(我不想使用这种方法)
我看得出来
"mongodb/mongodb": "^1.3",
但这样我就不能使用一些功能,比如aggregateCursor
Attempted to call an undefined method named "aggregateCursor" of class "MongoDB\Collection"
或者我不能用
$m=new\MongoClient()
试图从全局命名空间加载类“MongoClient”
要连接到mongoDb,我必须使用
新建\MongoDB\Client
我用的是Symfony,但我认为它不相关
作曲家版本1.6.5 2018-05-04 11:44:5
PHP 7.2.1(cli)(构建时间:2018年1月15日12:20:50)(NTS)
版权所有(c)1997-2017 PHP集团
按照以下步骤,它将工作
sudo apt-get install php7.2-dev
sudo apt-get install libcurl4-openssl-dev pkg-config libssl-dev libsslcommon2-dev
sudo apt-get install php-pear
sudo pecl install mongodb
转到php.ini
文件
extension=mongodb.so
对于基于Debian的操作系统,请使用以下命令
sudo apt-get install php-mongodb
听起来很奇怪。我唯一能想象的是。。。是使用不同php运行时和/或ini/config的composer。但这是从纯理论的角度出发的,因此没有进一步的实际建议;o/尽管这可能是一个有效的解决方案,但我们不知道作者使用的是基于Debian的操作系统还是Linux。另外,请编辑您的帖子,以便解释解决方案是什么。上面的命令适用于基于Debian的php和mangodb驱动程序操作系统
sudo apt-get install php7.2-dev
sudo apt-get install libcurl4-openssl-dev pkg-config libssl-dev libsslcommon2-dev
sudo apt-get install php-pear
sudo pecl install mongodb
extension=mongodb.so
sudo apt-get install php-mongodb