2
votes

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
1
did you get the answer @creativasium - Amanjot Kaur

1 Answers

-1
votes

In the lastest version, you can use new MongoDB\Driver\Manager() to create the obj instead of the MongoClient().