简体   繁体   English

MongoDB,Windows 7,XAMPP,PHP.ini

[英]MongoDB, Windows 7, XAMPP, PHP.ini

I am having a lot of trouble getting XAMPP to work with MongoDB on Windows 7. 我在使用XAMPP在Windows 7上使用MongoDB时遇到了很多麻烦。

I'm using XAMPP 1.7.7/PHP 5.3.8. 我正在使用XAMPP 1.7.7 / PHP 5.3.8。

I have MongoDB setup properly and can query via a shell (and MongoD.exe is running). 我正确设置了MongoDB,可以通过shell进行查询(并且MongoD.exe正在运行)。

But whenever I try to access MongoDB via a PHP script, I get the error (via CodeIgniter): 但每当我尝试通过PHP脚本访问MongoDB时,我都会收到错误(通过CodeIgniter):

The MongoDB PECL extension has not been installed or enabled 尚未安装或启用MongoDB PECL扩展

It does NOT show MongoDB in the extensions when I run phpinfo(). 当我运行phpinfo()时,它不会在扩展中显示MongoDB。 However, I've used the drivers located here https://github.com/mongodb/mongo-php-driver/downloads and added the appropriate lines to php.ini 但是,我使用了这里的驱动程序https://github.com/mongodb/mongo-php-driver/downloads并将相应的行添加到php.ini

It seems to me that the server isn't actually reading php.ini. 在我看来,服务器实际上并没有读取php.ini。 I have tried every version of the 5.3 driver in that zip file and it never loads. 我已尝试该zip文件中的每个版本的5.3驱动程序,它永远不会加载。 There are also no errors in the PHP error log OR the Apache error log. PHP错误日志或Apache错误日志中也没有错误。

phpinfo() says it's using the following php.ini files: phpinfo()说它使用以下php.ini文件:

> Configuration File (php.ini) Path C:\Windows 
> Loaded Configuration File C:\xampp\php\php.ini

There is NOT a php.ini file in C:\\Windows. C:\\ Windows中没有php.ini文件。 The only php.ini that exists on my machine is in C:\\xampp\\php\\php.ini and modifying it seems to have absolutely no effect. 我机器上唯一存在的php.ini是在C:\\ xampp \\ php \\ php.ini中,修改它似乎完全没有效果。 Even if I put extension=norealfilename.abc, it doesn't throw an error, which seems odd. 即使我把extension = norealfilename.abc,它也不会抛出错误,这似乎很奇怪。

I'm totally at a loss here and I've lost several days trying to get this going and am beyond frustrated. 我在这里完全不知所措,我已经失去了好几天试图让这种情况发生并且我感到非常沮丧。 Any help would be appreciated. 任何帮助,将不胜感激。

Other relevant phpinfo() information: System Windows NT MY-PC 6.1 build 7601 (Windows 7 Home Premium Edition Service Pack 1) i586 Compiler MSVC9 (Visual C++ 2008) Architecture x86 Thread Safety enabled 其他相关的phpinfo()信息:系统Windows NT MY-PC 6.1 build 7601(Windows 7家庭高级版Service Pack 1)i586编译器MSVC9(Visual C ++ 2008)架构x86线程安全已启用

If you need more information let me know and I will update this question. 如果您需要更多信息,请通知我,我将更新此问题。

I did the following (to use with Codeigniter): 我做了以下(与Codeigniter一起使用):

Downloaded from https://github.com/mongodb/mongo-php-driver/downloads https://github.com/mongodb/mongo-php-driver/downloads下载

*Careful to get the thread-safe version. *小心获得线程安全版本。

Then add this line in your php.ini file: 然后在php.ini文件中添加以下行:

extension=php_mongo-1.2.11-5.3-vc9-x86_64.dll (or whatever version did you download) extension = php_mongo-1.2.11-5.3-vc9-x86_64.dll(或者你下载的是什么版本)

Then restart your server and check the error log to see if there are any errors/conflicts. 然后重新启动服务器并检查错误日志以查看是否存在任何错误/冲突。

PS: I use WAMP! PS:我用WAMP!

After testing several builds, the one which worked for me was: php_mongo-1.3.1-5.3-vc9-x86_64.dll from this package. 在测试了几个版本之后,对我有用的版本是:来自这个软件包的php_mongo-1.3.1-5.3-vc9-x86_64.dll。 http://cloud.github.com/downloads/mongodb/mongo-php-driver/php_mongo-1.3.1.zip My environment: Windows 8 64 bits x64 based processor. http://cloud.github.com/downloads/mongodb/mongo-php-driver/php_mongo-1.3.1.zip我的环境:基于Windows 8 64位x64的处理器。 Winginx Php 5.3.8 Winginx Php 5.3.8

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

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