无法使用作曲家在 symfony2 中安装 mongodb 学说

Can#39;t install mongodb doctrine in symfony2 with composer(无法使用作曲家在 symfony2 中安装 mongodb 学说)
本文介绍了无法使用作曲家在 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.

  1. 运行命令:php --ini,你会看到所有的配置文件都解析好了!对我来说,我使用的是 PHP-fpm,我认为唯一需要的 php.ini 文件在 fpm 文件夹中,但我错了 CLI 文件夹中有一个 php.ini 文件,正是这个文件夹告诉服务器加载了哪些模块,并且与学说从中读取扩展名的文件完全相同.
  2. 打开 CLI/php.ini 并在末尾添加这一行 extension=mongo.so.
  3. 重启PHP:service php5-fpm restart
  1. 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.
  2. Open CLI/php.ini and add this line in the end extension=mongo.so.
  3. Restart PHP : service php5-fpm restart

就是这样!

这篇关于无法使用作曲家在 symfony2 中安装 mongodb 学说的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Convert JSON integers and floats to strings(将JSON整数和浮点数转换为字符串)
in php how do I use preg replace to turn a url into a tinyurl(在php中,如何使用preg替换将URL转换为TinyURL)
all day appointment for ics calendar file wont work(ICS日历文件的全天约会不起作用)
trim function is giving unexpected values php(Trim函数提供了意外的值php)
Basic PDO connection to MySQL(到MySQL的基本PDO连接)
PHP number_format returns 1.00(Php number_Format返回1.00)