PECL mongodb Extension Link Many of our development work is done under Windows, but installing some plug-in extensions to these scripts under Windows is cumbersome, and there's no way to do it like a Linux environment. Here I have encountered some problems when installing MongoDB extensions for PHP, so I would write a tutorial on Wamp installation of PHP extensions.
1. Download MongoDB extension
Download the MongoDB extension for PHP under the Windows environment.
PHP extensions under Windows are typically DLL files, and MongoDB's PHP extensions are downloaded here:
Http://pecl.php.net/package/mongo
Here we choose the latest DLL download.
Extensions typically differentiate between non thread safe (non-thread safe) and thread safe (thread safe), where non-thread safety is typically used with the IIS environment, and thread safety is paired with Apache. Of course, in addition to PHP VC6 VC9 version distinguish VC6 and VC9 a support Apache a support IIS,VC9 used on Apache also no problem. There is, of course, more to come here and no more discussion.
My environment is WIN10 64-bit Wamp (apache+php5.5) then download the php5.5 Thread Safe (TS) x64 that file.
2. Installing MongoDB Extensions
Download and open the ZIP package later we will find the Php_mongo.dll file.
Copy this file to the folder under the path "Wamp\bin\php\php5.5.12\ext".
If you install PHP yourself, copy it into the PHP ext folder. Then we have to modify the php.ini configuration file to let PHP load this extension.
Find your php.ini edit this file and add
Extension=php_mongo.dll
The purpose of this file is to tell PHP that we have installed such an extension to start the next boot.
3. Let MongoDB's extension find the Libsasl.dll dependent library
Libsasl.dll is a folder in the PHP root directory, this article MongoDB needs to rely on this DLL. Since the Wamp installation process does not add PHP environment variables, so when we use the PHP mongodb extension, the extension cannot find the location of Libsasl.dll, which makes MongoDB extension unusable.
We need to add the directory path of PHP to our system environment variables.
4. Test whether the MongoDB extension installation was successful
Finally, we restart all the Wamp services, it is best to turn wamp off and reopen. Launch Wamp's localhost page to find Phpinfo ()
The word MONGO appears, which indicates that MongoDB installation was successful.
Wamp Environment PHP Installation MongoDB extension