无法使用作曲家在 symfony2 中安装 mongodb 学说
我已经关注了官方的文档
当我运行 composer update 我有这个错误:您的需求无法解析为一组可安装的软件包.
when I run composer update I have this error : Your requirements could not be resolved to an installable set of packages.
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 扩展..谢谢 !
When I run php -m
I can't find mongo extension , but the server is running and I can use Mongo in PHP, does anyone know what should the problem be ?
I doubt that the doctrine can't find the mongo extension..
thanks !
推荐答案
我修好了!正如预期的那样,这是因为扩展,所以如果您遇到与我相同的问题,请采取以下步骤:您的系统缺少请求的 PHP 扩展 mongo.
I fixed it !
As expected, it was because of the extension so here are the steps to take if you face the same problem as me : the requested PHP extension mongo is missing from your system.
- 运行命令:
php --ini
,你会看到所有的配置文件都解析好了!对我来说,我使用的是 PHP-fpm,我认为唯一需要的 php.ini 文件在 fpm 文件夹中,但我错了 CLI 文件夹中有一个 php.ini 文件,正是这个文件夹告诉服务器加载了哪些模块,并且与学说从中读取扩展名的文件完全相同. - 打开 CLI/php.ini 并在末尾添加这一行
extension=mongo.so
. - 重启PHP:
service php5-fpm restart
- run the command :
php --ini
, you will see all the configuration files parsed! For me , I am using PHP-fpm , I thought the only php.ini file needed was inside fpm folder, but I was wrong there was a php.ini file inside CLI folder and it's this folder that tells the server which modules are loaded , and it's exactly the same file that doctrine reads the extensions from. - Open CLI/php.ini and add this line in the end
extension=mongo.so
. - Restart PHP :
service php5-fpm restart
就是这样!
相关文章