Home >Backend Development >PHP Tutorial >MongoDB installation

MongoDB installation

WBOY
WBOYOriginal
2016-08-08 09:23:341091browse

1. Prepare the required tools

1) Windows 7 64bit

2) MongoDB browsing

2. Installation

1) Unzip mongodb-win32-x86_64-3.0.3.zip to d:program_filesMongoDB

2) d:program_filesMongoDBbin is added to the environment variable %mongo%

3) Create the directory %mongo%datadb to store the database

4) Create the directory %mongo%datalog to store the log

5) Create and Edit the configuration file %mongo%mongod.cfg

dbpath=<span>D:\program_files\MongoDB\data\db
logpath</span>=D:\program_files\MongoDB\data\log\mongo.log

6) Install MongoDB as a service

Run the following command with administrator privileges to create the MongoDB service

sc create MongoDB binPath= <span>"</span><span>\</span><span>"</span>D:\program_files\MongoDB\bin\mongod.exe\<span>"</span><span> --service --c/span><span>"</span>D:\program_files\MongoDB\mongod.cfg\<span>""</span></span>

7) Start the service

net start mongodb

3. Use

1) Start the command line and enter mongo

2) show dbs

3) use test

4) insert

5) find

4. PHP development

1) Set up a PHP environment for browsing

2) Download the MongoDB PHP extension for browsing, and put it in the %PHP%ext directory

3) Modify php.ini and add the following code

extension=php_mongo.dll

4) Restart the Apache server

5) Browse the MongoDB PHP manual

The above has introduced the installation of MongoDB, including all aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn