简体   繁体   中英

Fatal error: Class MongoClient not found in wamp on Windows7 64-bit

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

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.

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(); ?> <?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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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