gpt4 book ai didi

php - 需要 ext-mongodb ^1.5.0 symfony

转载 作者:可可西里 更新时间:2023-11-01 10:01:59 25 4
gpt4 key购买 nike

我安装了 ext-mongodb

php --ri mongodb | grep version

MongoDB extension version => 1.5.1 
libbson bundled version => 1.11.0
libmongoc bundled version => 1.11.0

我在安装 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 -> 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 信息(更多详细信息)

mongodb
MongoDB support enabled
MongoDB extension version 1.5.1
MongoDB extension stability stable
libbson bundled version 1.11.0
libmongoc bundled version 1.11.0
libmongoc SSL enabled
libmongoc SSL library Secure Transport
libmongoc crypto enabled
libmongoc crypto library Common Crypto
libmongoc crypto system profile disabled
libmongoc SASL enabled
libmongoc ICU disabled
libmongoc compression enabled
libmongoc compression snappy disabled
libmongoc compression zlib enabled

如果我尝试使用 composer 安装 mongodb

composer require mongodb/mongodb 我有那个错误

如果我使用(并且我不想使用这种方法)

composer install --ignore-platform-reqs

我看见了

    "mongodb/mongodb": "^1.3",

但是通过这种方式我不能使用一些功能,比如 aggregateCursor

Attempted to call an undefined method named "aggregateCursor" of class "MongoDB\Collection"

否则我无法使用$m = new\MongoClient();

Attempted to load class "MongoClient" from the global namespace.

为了连接到 mongoDb,我必须使用

new \MongoDB\Client

我使用 Symfony,但我认为它不相关

Composer version 1.6.5 2018-05-04 11:44:5

PHP 7.2.1 (cli) (built: Jan 15 2018 12:20:50) ( NTS ) Copyright (c) 1997-2017 The PHP Group

最佳答案

按照以下步骤,它将起作用。

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

关于php - 需要 ext-mongodb ^1.5.0 symfony,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51268761/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com