工具準備
https://www.mongodb.com/download-center
# 下載community server
wget https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-3.6.5-signed.msi
# 下載compass 圖形化管理工具
wget https://downloads.mongodb.com/compass/beta/mongodb-compass-community-1.14.0-beta.2-win32-x64.exe?_ga=2.32424510.1600486838.1528162084-24234926.1528162084
# 這裏解釋下爲何要從新下載compass, 下面會說明
安裝
安裝community server版本
不要勾選compass,一路next
安裝compass
一路next
啓動mongodb
建立配置文件
systemLog:
destination: file
path: D:\dbdepot\mongodb\demo\log\mongod.log
storage:
dbPath: D:\dbdepot\mongodb\demo
註冊服務
mongod.exe --config "D:\dbdepot\mongodb\demo.cfg" --install --serviceName "mongodb_demo1" --serviceDisplayName "mongodb_demo1"
啓動mongo服務
net start mongodb_demo1
net stop mongodb_demo1
安裝php擴展
# https://pecl.php.net/package/mongodb
下載mongodb 對應window下php環境的dll文件
php.ini
extenstion = php_mongodb.dll
重啓apache或php-fpm