douqian1975
2015-08-07 10:08
浏览 62

致命错误:在Windows7 64位上的wamp中找不到类MongoClient

I download and install the MongoDB-3.0.5 from its official website and then I using the Robomongo for the easy interface and then MongoVUE for the importing and exporting the old Mysql database because it helps a lot in a easy way for importing the old database. I imported my old Database from MongoVUE tool is goes very good.

I am using wampp server for the connectivity of the PHP interface. I am using PHP version 5.5 The driver of PHP which I am using for connection was downloaded form this link.

There are many files on the link. I chose "php_mongo-1.6.8.zip". When I extracted files which are in .dll format I chose "php_mongo-1.6.8-5.5-vc11.dll" and copy to "C:\wamp\bin\php\php5.5.12\ext" this directory and then rename above .dll file to "php_mongo.dll" and open the "php.ini" file in notepad and in the end of all extensions I wrote "extension=php_mongo.dll" after saving I click on "Restart all Services" in wamp portal. After doing all this when i m going to run my PHP file it shows this Fatal error: Class MongoClient not found and then i used the "php_mongo-1.6.8-5.5-vc9.dll" and copied it to above directory and rename it to "php_mongo.dll". but there is still same error.

图片转代码服务由CSDN问答提供 功能建议

我从官方网站下载并安装MongoDB-3.0.5,然后使用Robomongo轻松实现界面 然后MongoVUE用于导入和导出旧的Mysql数据库,因为它有助于导入旧数据库的简单方法。 我从MongoVUE工具导入了我的旧数据库非常好。

我使用wampp服务器来连接PHP接口。 我正在使用PHP版本5.5我用于连接的PHP驱动程序是从链接

链接上有许多文件。 我选择了“ php_mongo-1.6.8.zip ”。 当我提取.dll格式的文件时,我选择“ php_mongo-1.6.8-5.5-vc11.dll ”并复制到“ C:\ wamp \ bin \ php \ php5。 5.12 \ ext “此目录然后将 .dll 文件重命名为” php_mongo.dll “并打开” php.ini “文件在记事本中,在我写的所有扩展名的末尾” extension = php_mongo.dll “保存后我点击了wamp portal中的”重新启动所有服务“。 完成所有这些后,当我要运行我的PHP文件时,它显示此致命错误:未找到类MongoClient 然后我使用了“ php_mongo-1.6.8-5.5-vc9.dll < / em>“并将其复制到上面的目录并将其重命名为” php_mongo.dll “。 但仍有同样的错误。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • doushi1960 2015-08-07 10:52
    已采纳

    I figured out the solution of my problem there were mainly 2 reasons for this error in my system.

    1. There was IIS web server running at same time.
    2. I was using wrong .dll file from the wrong link.

    What I done for overcoming this error is as follows if any one has same issue please watch out my steps.

    1. Uninstall IIS web server, web deploy 3.5 and all there components
    2. Uninstall MongoDB, Robomongo & Wamp server
    3. Restart PC
    4. Install only Mongodb 3.0.5 with default setting and options
    5. Create data\db in C:\ drive
    6. Run mongod.exe file, when in command prompt window it shows that "waiting for connection" (You are doing well). Don't close it kept it running.
    7. Install Wamp server and after installation don't launch it (if it is, exit it completely)
    8. Use this Link for the downloading for the driver files.
    9. I m using PHP 5.5 with 64-bit Windows that's why I clicked on "5.5 Thread Safe (TS) x64"
    10. After downloading and extracting copy file "php_mongo.dll" to the "C:\wamp\bin\php\php5.5.12\ext"
    11. Open php.ini in notepad from "C:\wamp\bin\php\php5.5.12" and add "extension=php_mongo.dll" in the end of collection of extensions. (Don't use semi colon before it)
    12. After saving and closing notepad open Wamp services and run your PHP file.
    13. This time it will be OK.
    点赞 打赏 评论
  • dongyi6183 2015-08-07 10:57

    Most probably you don't edit the correct php.ini file.

    In order to be sure that the php_mongo.dll file is not loaded at all, use the <?php echo phpinfo(); ?> tag and see if it appears there. If not try to add the extension to the phpForApache.ini file.

    Refer to this forum post for more info.

    点赞 打赏 评论

相关推荐 更多相似问题