0

I want to use MongoDB in my Symfony2 project. I added in composer.json (required section)

    "doctrine/mongodb": "1.2.*@dev",
    "doctrine/mongodb-odm": "1.0.*@dev",
    "doctrine/mongodb-odm-bundle": "3.0.*@dev"

But when I updated composer, an error occurred

Problem 1
- Installation request for doctrine/mongodb 1.2.*@dev -> satisfiable by doctrine/mongodb[1.2.x-dev].
- doctrine/mongodb 1.2.x-dev requires ext-mongo >=1.2.12,<1.6-dev -> the requested PHP extension mongo is missing from your system.

I am using Wamp and I added (as indicated in this post) php_mongo.dll in the ext directory. phpinfo() function indicates that Mongo is available When I press the Wamp button, "php_mongo" extension appears. However, when I execute php -m, mongo extension isn't listed.

C:\wamp\www>php --ini
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File:         C:\wamp\bin\php\php5.4.16\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

I don't have any file like php.ini in the C:\Windows directory.

Community
  • 1
  • 1
Antonin M.
  • 1,744
  • 1
  • 18
  • 29
  • If you run `php -i` (which is `phpinfo()` for the command line), it should list the `extension_dir` where `php_mongo.dll` is expected to be found, eg: `C:\wamp\bin\php\php5.4.16\ext\`. As per the answer from RiggsFolly, I expect the `php.ini` path on the command line differs from that used in the by the Apache server (it definitely does on my WAMP install). – Stennie Aug 03 '14 at 13:02

1 Answers1

3

As Composer runs in PHPCLI ( Command Line Interface ) have you also added the mongo extension to the php.ini that the CLI uses, its not the same one as used by Apache.

So try adding it to C:\wamp\bin\php\php5.4.16\php.ini

When you use the wampmanager icon menus, you are editing the php.ini that is used by Apache which would be in the \wamp\bin\apache\apachex.y.z\bin folder.

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149