Reference:
http://jingyan.baidu.com/article/d5c4b52bef7268da560dc5f8.html
http://www.jb51.net/article/51601.htm
1 Install mongodb server
(1) Go to download Page to download the package under windows
https://www.mongodb.org/downloads#production
(2) Double-click the downloaded msi file and select the installation location. It is recommended to place it in the folder in the root directory of the disk , to facilitate subsequent operations. After installation, you should see the structure as shown below (the files and folders crossed out with red lines are not included)
(3) Create a storage location for the database file, such as d:/mongodb/ data/db. Before starting the mongodb service, you need to create the storage folder for the database file, otherwise the command will not be automatically created and the startup will not be successful.
(4) Open the cmd command line (windows key + r, enter cmd and run)
Enter the installation location of mongodb. The installation location here is d:mongodbbin
Execute
mongod.exe -- dbpath d:mongodbdatadb
This command
(5) mongodb connects to port 27017 by default. Open http://localhost:27017 to check. If you find the picture below, it means the connection is successful. If it is unsuccessful, you can check whether the port is blocked. occupied.
2 Configure php's mongodb extension
(1) Download php_mongo.dll
First you need to check the current php version and supported extension version (note the content in the red box)
You can see The author is using php5.4.16 version, x86 (32-bit), which supports TS (Thread Safe) php extension
At this time, go to the place where you downloaded the dll and find the corresponding version
http://pecl.php. net/package/mongo/1.6.12/windows
In view of the previous version of the poster, I chose the red version in the picture below
(2) Place the downloaded dll file in the corresponding location
The location is {path}/php/ext folder
Since the poster uses the xampp integrated environment, the location is at
D:xamppphpext
(3) Open php.ini
The location of this file is at {path }/php/
The poster added the following line in D:
3The above introduces the Windows php54 configuration mongodb extension (with download addresses for various other versions), including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.