简体   繁体   中英

Fatal error: Class 'MongoClient' not found

I want to connect to MongoDB from PHP but I keep getting the fatal error in the title. My PHP version is 5.5.14, architecture x86, thread safety enabled, VC11.

So I downloaded 5.5 Thread Safe (TS) x86 from PECL , extracted php_mongo.dll to the \\ext\\ folder of my php installation, added extension=php_mongo.dll to the php.ini file, and restarted Apache.

I keep getting the same fatal error when I use either Mongo() and MongoClient() .

Also, I can access mongo from CMD, starting it with mongod and then opening another cmd window to handle the database using mongo . I installed PHP and Apache separately (No XAMPP or WAMP) on Windows 8.1 x64.

Installation folders:

  • Apache: C:\\Apache24
  • PHP: C:\\php
  • MongoDB: C:\\Program Files\\MongoDB

在最新版本中,您可以使用新的MongoDB \\ Driver \\ Manager()创建obj而不是MongoClient()。

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