Mongo extension with MongoClient class is deprecated. Instead, the MongoDB extension should be used.
MongoClient class is included in “Mongo” that is official MongoDB driver for PHP. MongoClient class is required to connect MongoDB and required by several packages that bridge between MongoDB and PHP. Here is detail of this driver on php.net: http://php.net/manual/en/mongo.manual.php
Mongo works on almost all of Operating Systems including Windows, Mac OS X, Unix, and Linux; little- and big-endian machines. No matter 32 or 64-bit machines. PHP 5.3 through 5.6. To install it, there is a “mongo” package on PECL.
To install Mongo for Windows, you need to do following steps (Tested with Windows 7) :
- Download this package from PECL website manually. Go to PECL Mongo package and choose latest stable version’s DLL by clicking on DLL link.
- Choose Thread safe x86 version, even for 64 bit system and download it. 64-bit version didn’t work for some people while x86 on 64-bit system worked fine so use download x86 thread safe version.
- Extract the zip file that is just downloaded, and place it in your PHP’s ext (extensions) directory. Ext directory can be find through phpinfo().
- Once placed in PHP’s ext directory, open your php.ini file and add follwing line and save it:
- Then restart your apache server and test your code which use MongoClient class. It should work now.
In case of any problem, feel free to ask in comments.