我跟随官方documentation
当我运行composer update时出现此错误: 您的要求无法解析为可安装的软件包。
Problem 1
- doctrine/mongodb 1.0.4 requires ext-mongo >=1.2.12,<1.6-dev -> the requested PHP extension mongo is missing from your system.
- doctrine/mongodb 1.0.3 requires ext-mongo >=1.2.12,<1.5-dev -> the requested PHP extension mongo is missing from your system.
- doctrine/mongodb 1.0.2 requires ext-mongo >=1.2.12,<1.4-dev -> the requested PHP extension mongo is missing from your system.
- doctrine/mongodb 1.0.1 requires ext-mongo >=1.2.12,<1.4-dev -> the requested PHP extension mongo is missing from your system.
- doctrine/mongodb 1.0.0 requires ext-mongo >=1.2.12,<1.4-dev -> the requested PHP extension mongo is missing from your system.
- doctrine/mongodb-odm 1.0.0-BETA9 requires doctrine/mongodb 1.0.* -> satisfiable by doctrine/mongodb[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4].
- Installation request for doctrine/mongodb-odm 1.0.0-BETA9 -> satisfiable by doctrine/mongodb-odm[1.0.0-BETA9].
当我运行php -m
时,我找不到mongo扩展,但服务器正在运行,我可以在PHP中使用Mongo,有谁知道问题应该是什么?
我怀疑这个学说找不到mongo扩展..
谢谢 !
答案 0 :(得分:19)
我修好了!
正如预期的那样,这是因为扩展所以如果您遇到与我相同的问题,请采取以下步骤:the requested PHP extension mongo is missing from your system.
php --ini
,您将看到所有配置文件都已解析!对我来说,我使用PHP-fpm,我认为所需的唯一php.ini文件是在fpm文件夹中,但我错了在CLI文件夹中有一个php.ini文件,它是这个文件夹告诉服务器哪些模块被加载,它与doctrine从中读取扩展名的文件完全相同。extension=mongo.so
。service php5-fpm restart
就是这样!
答案 1 :(得分:1)
for OSX:
brew install php56-mongo
如果错误输出:请仔细阅读错误消息并按照它重新运行命令。
源:
http://php.net/manual/en/mongo.installation.php#mongo.installation.osx
答案 2 :(得分:0)
要安装PHP的MongoDB扩展,请运行:
sudo apt-get install php-mongo
另请参阅:Easiest way to install Mongodb PHP extension in Ubuntu 13.10 (saucy)?