简体   繁体   English

通过作曲家的教义mongodb安装错误

[英]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. 我正在尝试通过我的本地计算机上的Zend Framework 2的作曲家安装Doctrine MongoDB ODM 模块 ,但我一直收到错误声明我的计算机中缺少PHP扩展芒果。 I am working on a Windows 7 x64 with WAMP 2.2 installed. 我正在安装安装了WAMP 2.2的Windows 7 x64。 I originally installed the 1.3.1 mongodb php driver. 我最初安装了1.3.1 mongodb php驱动程序。 However, I found out that this driver isn't supported by MongoDB ODM yet so I downgraded to 1.2.12. 但是,我发现MongoDB ODM不支持这个驱动程序,所以我降级到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. 我检查了phpinfo和MongoDB出现在那里。 I was successfully able to connect to a local database with a simple php script without doctrine. 我成功地使用一个简单的PHP脚本连接到本地数据库,没有学说。 So I know Wamp and mongoDB are working fine. 所以我知道Wamp和mongoDB工作正常。 the problem is when integrating doctrine. 问题在于整合学说。 Any ideas or suggestions troubleshooting this is greatly appreciated. 任何有关此问题的建议或建议都非常感谢。 thanks 谢谢

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. 我发现Composer在PHP-CLI上运行,在wamp的情况下,有两个php.ini文件:一个在php文件夹中,一个在apache文件夹中。 the one in the apache directory is used with the webserver which is what is edited when accessing php.ini from wamp. apache目录中的那个与webserver一起使用,这是从wamp访问php.ini时编辑的内容。 I usually edit my php.ini from wamp so in effect I end up editing php.ini in apache. 我通常从wamp编辑我的php.ini,所以实际上我最终在apache中编辑php.ini。

composer in the other had is accessing the php.ini located in the php directory. 另一个作曲家正在访问位于php目录下的php.ini。 this php.ini does not know about the mongo extension, hence the error about missing extension. 这个php.ini不知道mongo扩展,因此关于缺少扩展的错误。 As a solution to the problem, I added the extension of mongodb in the php.ini located in the php directory. 作为问题的解决方案,我在php目录中的php.ini中添加了mongodb的扩展名。 Restarted wamp and ran composer once more. 重新启动wamp并再次运行composer。 The outcome, the module installed succesfully!. 结果,模块安装成功!

You have to install mongo php extension 你必须安装mongo php扩展

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM