Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

doctrine mongodb intallation error through composer

I am trying to install Doctrine MongoDB ODM module through composer with Zend Framework 2 on my local machine but I keep getting an error stating that PHP extension mango is missing from my computer. I am working on a Windows 7 x64 with WAMP 2.2 installed. I originally installed the 1.3.1 mongodb php driver. However, I found out that this driver isn't supported by MongoDB ODM yet so I downgraded to 1.2.12. After I tried the installation again I kept getting the same error:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - doctrine/mongodb 1.0.0-BETA3 requires ext-mongo >=1.3.1,<1.4-dev -> the re
quested PHP extension mongo is missing from your system.
    - doctrine/mongodb 1.0.0-BETA2 requires ext-mongo >=1.2.12,<1.3-dev -> the r
equested PHP extension mongo is missing from your system.
    - doctrine/mongodb 1.0.0-BETA1 requires ext-mongo * -> the requested PHP ext
ension mongo is missing from your system.
    - doctrine/doctrine-mongo-odm-module dev-master requires doctrine/mongodb-od
m 1.* -> satisfiable by doctrine/mongodb-odm 1.0.0-BETA4, doctrine/mongodb-odm 1
.0.0-BETA5, doctrine/mongodb-odm 1.0.0-BETA6.
    - doctrine/mongodb-odm 1.0.0-BETA4 requires doctrine/mongodb 1.0.0-BETA1 ->
satisfiable by doctrine/mongodb 1.0.0-BETA1.
    - doctrine/mongodb-odm 1.0.0-BETA5 requires doctrine/mongodb 1.0.0-BETA1 ->
satisfiable by doctrine/mongodb 1.0.0-BETA1.
    - doctrine/mongodb-odm 1.0.0-BETA6 requires doctrine/mongodb >=1.0.0-beta1,<
1.1-dev -> satisfiable by doctrine/mongodb 1.0.0-BETA1, doctrine/mongodb 1.0.0-B
ETA2, doctrine/mongodb 1.0.0-BETA3.
    - Installation request for doctrine/doctrine-mongo-odm-module dev-master ->
satisfiable by doctrine/doctrine-mongo-odm-module dev-master.

I checked phpinfo and MongoDB shows up there. I was successfully able to connect to a local database with a simple php script without doctrine. So I know Wamp and mongoDB are working fine. the problem is when integrating doctrine. Any ideas or suggestions troubleshooting this is greatly appreciated. thanks

like image 951
paxtor Avatar asked Dec 12 '12 02:12

paxtor


1 Answers

I found out that Composer runs on PHP-CLI and in the case of wamp, there are two php.ini files: one in the php folder and one in apache folder. the one in the apache directory is used with the webserver which is what is edited when accessing php.ini from wamp. I usually edit my php.ini from wamp so in effect I end up editing php.ini in apache.

composer in the other had is accessing the php.ini located in the php directory. this php.ini does not know about the mongo extension, hence the error about missing extension. As a solution to the problem, I added the extension of mongodb in the php.ini located in the php directory. Restarted wamp and ran composer once more. The outcome, the module installed succesfully!.

like image 175
paxtor Avatar answered Nov 09 '22 08:11

paxtor