我有mongodb版本3.2.3和php mongo驱动程序版本1.6.12。 我正在尝试使用作曲家安装 mongo-php 库。
$ composer require "mongodb/mongodb=^1.0.0"
并得到此错误:
Your version of PHP, 5.4.16, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
问题1
- mongodb/mongodb 1.0.1 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system. - mongodb/mongodb 1.0.0 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system.
- Installation request for mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1].
To enable extensions, verify that they are enabled in those .ini files:
- /etc/php.ini
- /etc/php.d/curl.ini
- /etc/php.d/dom.ini
- /etc/php.d/fileinfo.ini
- /etc/php.d/json.ini
- /etc/php.d/mbstring.ini
- /etc/php.d/mysql.ini
- /etc/php.d/mysqli.ini
- /etc/php.d/pdo.ini
- /etc/php.d/pdo_mysql.ini
- /etc/php.d/pdo_sqlite.ini
- /etc/php.d/phar.ini
- /etc/php.d/posix.ini
- /etc/php.d/sqlite3.ini
- /etc/php.d/sysvmsg.ini
- /etc/php.d/sysvsem.ini
- /etc/php.d/sysvshm.ini
- /etc/php.d/wddx.ini
- /etc/php.d/xmlreader.ini
- /etc/php.d/xmlwriter.ini
- /etc/php.d/xsl.ini
- /etc/php.d/zip.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, deleting ./composer.json.
需要帮助来解决此问题。我是否使用了错误的库版本?任何人都可以分享我可以安装 mongo php 库的链接或命令。
Your version of PHP, 5.4.16, is affected by CVE-2013-6420
您需要更新您的 php 版本。转到 php 7!
对于低于 php 5.6 的 php 请尝试以下操作:
$ pecl install mongodb
$ echo "extension=mongodb.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:'s*||"`
或者根据您的PHP版本下载 mongodb.so 文件并将其粘贴到PHP/ext文件夹中。
有关 mongo lib 和驱动程序兼容性的更多信息,请使用以下链接
https://docs.mongodb.com/ecosystem/drivers/php/
$pecl install mongodb
.在 php 中.ini您添加extension=mongodb.so
.如果你得到错误:sasl.h notfound
,你需要安装 cyrus-sasl-devel,如果在 php-par 中出错,因为版本 php 5.6,你应该卸载 php-pear 并安装 php56w-pear。