我有mongodb版本3.2.3和php mongo驱动版本1.6.12。我正在尝试使用composer安装mongo-php library。
$ 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库的链接或命令。
答案 0 :(得分:0)
Your version of PHP, 5.4.16, is affected by CVE-2013-6420
您需要更新您的php版本。转到php 7!
答案 1 :(得分:0)
以下php 5.6 plz试试这个:
$ pecl install mongodb
$ echo "extension=mongodb.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
或根据您的php版本下载mongodb.so文件并将其粘贴到php / ext文件夹中。
有关mongo lib和驱动程序兼容性的更多信息,请使用以下链接
答案 2 :(得分:0)
$pecl install mongodb
。在php.ini中添加extension=mongodb.so
。如果你得到错误:sasl.h notfound
,你需要安装cyrus-sasl-devel,如果在php-pear中出错,因为版本为php 5.6你应该卸载php-pear并安装php56w-pear。