Configure mongodb extension in windowsphp54 (with download addresses of various other versions)

Source: Internet
Author: User
Tags mongodb server php mongodb
: This article mainly introduces how to configure mongodb extensions in windowsphp54 (with other versions). For more information about PHP tutorials, see. Refer:

Http://jingyan.baidu.com/article/d5c4b52bef7268da560dc5f8.html

Http://www.jb51.net/article/51601.htm

1. install the mongodb server

(1) Download the package in windows from the download page.

Https://www.mongodb.org/downloads#production

(2) double-click the downloaded msi file and select the installation location. we recommend that you put it in the folder under the root directory of the disk to facilitate subsequent operations, after the installation is complete, you should see the such structure (the files and folders that are redlined are not counted)


(3) Create a storage location for database files, such as d:/mongodb/data/db. Before starting the mongodb service, you must create a folder for storing database files. Otherwise, the command will not be created automatically and cannot be started successfully.


(4) open the cmd command line (windows key + r, enter cmd, and then run)

Go to the mongodb installation location, where the installation location is d: \ mongodb \ bin

Run

Mongod.exe -- dbpath d: \ mongodb \ data \ db

This command

(5) mongodb default connection port 27017. open http: // localhost: 27017 to check whether the connection is successful. if the connection fails, check whether the port is occupied.

2. configure mongodb extension for php

(1) Download php_cmd.dll

First, check the current php version and supported extension versions (note the content in the red box)


We can see that the main user uses php5.4.16, x86 (32-bit), and supports TS (Thread Safe) php extension.

At this time, go to the download dll to find the corresponding version

Http://pecl.php.net/package/mongo/1.6.12/windows

In view of the previous version of the building Lord, we chose the medium-red version.

(2) place the downloaded dll file to the corresponding location

The path is in the {path}/php/ext folder.

Because the landlord uses the xampp integrated environment, the location is

D: \ xampp \ php \ ext

(3) open php. ini

The file is located in {path}/php/

The poster is in D: \ xampp \ php

Add the following line

Extension = php_cmd.dll

(4) restart the apache server

View phpinfo again

What you can see

3. use the mongodb extension of php to connect to the database and test the connection.


 ListDBs ();?>

Displayed

The above is the installation of all mongodb servers and the extension installation and debugging of php mongodb.

The above introduces how to configure mongodb extensions in windows php54 (with other versions), including some content, and hope to help those who are interested in PHP tutorials.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.