简体   繁体   English

Mongodb没有配置为PHP

[英]Mongodb doesn't get configured to PHP

I know this question has been asked plenty of times but I still can't solve the issue. 我知道这个问题已被多次询问,但我仍然无法解决问题。 I have tried almost every solution out there. 我已经尝试了几乎所有的解决方案。 I have added php_mongo.dll in "ext" directory. 我在“ext”目录中添加了php_mongo.dll。 Then I added extension at the end of php.ini. 然后我在php.ini的末尾添加了扩展名。 I tried downloading mongo directly to my wamp directory as well. 我也尝试将mongo直接下载到我的wamp目录中。 php_mongo is checked in PHP extensions. 在PHP扩展中检查php_mongo。 But still it gives the error when I try to run a simple program like this one 但是当我尝试运行像这样的简单程序时,它仍然会出错

<?php
echo "hello";
$connection = new MongoClient(); // connects to localhost:27017


?>

It does print hello but then gives the error that MongoClient is unknown. 它打印你好,但然后给出MongoClient未知的错误。 My PHP is version 5.5.12 x64 and mongodb is also x64. 我的PHP版本是5.5.12 x64,mongodb也是x64。

Do the following using the wmapmanager menus 使用wmapmanager菜单执行以下操作

wampmanager -> Apache -> Version -> and click on the 2.X.X version number

This will cause wampmanager to rebuild all the SYMLINKS in the \\wamp\\bin\\apache\\apache2.XX\\bin folder. 这将导致wampmanager重建\\wamp\\bin\\apache\\apache2.XX\\bin文件夹中的所有SYMLINKS。

Are you sure you are editing the correct php.ini file. 您确定要编辑正确的php.ini文件吗? Use the wampmanager menu system to edit the correct php.ini file 使用wampmanager菜单系统编辑正确的php.ini文件

wampmanager -> PHP -> php.ini

You should add 你应该添加

extension=php_mongo.dll

Reboot the server 重新启动服务器

PS: Check that you aren't using a wrong mongo php_driver. PS:检查你没有使用错误的mongo php_driver。

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

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