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.
12 thoughts on “Installing MongoDB driver for PHP on Windows”
http://runotes.cloudns.org/naruto-sadness-and-sorrow-skachat-noty.html http://runotes.cloudns.org/naruto-wind-skachat-noty-dlya-pianino.html http://runotes.cloudns.org/linkin-park-no-more-sorrow-skachat.html
Now I use MongoDB 3.2.0 and it doesn’t support php_mongo.dll instead php_mongodb.dll.
When I use new MongoClient() or new Mongo(), it’s error. Do you have any suggestion?
i am also. i had that error message
we want to configure this with codeigniter we follow each step but still it shoaw some error
The MongoDB PECL extension has not been installed
we have follow all instruction as you given over.
The MongoDB PECL extension has not been installed or enabled
It show again error.
i had included php_mongo.dll file in php.ini file, and i am checking whether .dll file is loaded or not , but it tell me “file is not loaded”.(by using extension_loaded(“mongo”) function)
i had put php_mongo.dll file in php/ext folder….
and still getting error…
so,please help me.
i had tried all version of the .dll file
Once you have placed .dll file and given path in php.ini file, then you need to restart your web server (whether it is apache or nginx) to see any changes.
Also as mentioned above the post, new extension is mongodb not mongo. Please use mongodb extension. And then add
and then restart your server to see if it works.
there are two .ini files php.ini-devlopment and php.ini-production where to insert extension=php_mongodb.dll
i put php_mongodb.dll in extensions and php.in also but i got The MongoDB PECL extension has not been installed or enabled error