2016-03-09 123 views
0

我有mongodb版本3.2.3和php mongo驱动程序版本1.6.12。我正尝试使用作曲家安装mongo-php librarymongo 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. 

Problem 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
Your version of PHP, 5.4.16, is affected by CVE-2013-6420 

您需要更新你的PHP版本。转到PHP 7!

0

下面的PHP 5.6 PLZ试试这个:

$ pecl install mongodb 

$ echo "extension=mongodb.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` 

或下载文件mongodb.so按照你的PHP版本,并粘贴在PHP/ext文件夹。

约蒙戈lib和司机compatibiltiy更多信息使用下面的链接

https://docs.mongodb.com/ecosystem/drivers/php/

0

$pecl install mongodb。在php.ini中添加extension=mongodb.so。如果你得到错误:sasl.h notfound,你需要安装cyrus-sasl-devel,如果在php-pear中出现错误,由于版本php 5.6,你应该卸载php-pear并安装php56w-pear。