doctrine mongodb intallation error through composer
Asked Answered
S

2

5

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

Smoky answered 12/12, 2012 at 2:9 Comment(2)
check if mongo extenson listed in php -mClaver
I'm having problems right now because PECL downloaded version 1.4.2 and packagist's DOctrine ODM is expecting version less than 1.4. Guess I'm off to use mongo without doctrine.Milanmilanese
S
13

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!.

Smoky answered 12/12, 2012 at 19:59 Comment(3)
I am working with MAMP, and I found the php.ini in bin/php/php5.6.7/conf. Although I already had the mongo extension defined there. No idea what you mean with the other php.ini (where can I find it), but it still doesn't load for me... Any ideas?Sorus
@Nicolas. so you didn't find the other php.ini in the apache folder?Smoky
Well, in MAMP (on mac) I only have bin/apache2/bin/... And in that directory there is no php.ini. I can't find a apache folder in the MAMP root directory.Sorus
L
0

You have to install mongo php extension

https://github.com/mongodb/mongo-php-driver/downloads

Low answered 12/12, 2012 at 9:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.