mac搭建mnmp環境

2022-07-19 02:00:13 字數 1690 閱讀 9300

brew安裝nginx

brew install nginx
brew tap homebrew/dupes

brew tap josegonzalez/homebrew-php

brew install php56 --with-imap --with-tidy --with-debug --with-mysql --with-fpm

sudo vim ~/.zshrc

#在這個檔案最後新增下列語句:

export path="$(brew --prefix php56)/bin:$path"

export path="$(brew --prefix php56)/sbin:$path"

export path="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

#儲存檔案後,source下這個檔案,使剛剛新增的環境變數生效

source ~/.zshrc

安裝php71
brew unlink php56 #清除php56的軟鏈,此操作對軟體本身毫無影響

brew install php71

切換環境:

brew unlink php56

brew link php71

sudo vim ~/.zshrc

#在這個檔案最後新增下列語句:

export path="$(brew --prefix php71)/bin:$path"

export path="$(brew --prefix php71)/sbin:$path"

export path="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

#儲存檔案後,source下這個檔案,使剛剛新增的環境變數生效

source ~/.zshrc

brew安裝mysql
brew install mysql
mac檢視網路監聽
netstat -nat | grep listen
brew安裝redis
brew install redis
brew安裝redis擴充套件
brew install php71-redis
brew安裝mongodb
brew install mongodb
brew安裝mongodb擴充套件
brew install php71-mongodb
brew services啟動程式
brew services list #可以檢視當前已管理的服務,並且可看到啟動狀態,然後可以通過 start,stop等啟動和關閉對應軟體

sudo brew services start nginx

其他方法啟動nginx

sudo nginx

sudo nginx -s stop

sudo nginx -s reload

brew services start php71

brew services start mysql

brew services start redis

brew services start mongodb

Mac下配置mnmp環境

雖然比較喜歡玩下新語言,但是php還是常會用到的.lnmp很多人都聽過,但是不能用在mac上面,另外還有個mnpp但在osx 10.8.3下面跑不起來.所以自己手動一步步安裝,整理了方便安裝的bash指令碼,暫且叫mnmp吧,實際上也是mac nginx mysql php,也許有點標題黨,見諒見諒...

mac 環境搭建

把nginx和prce 放到同一目錄 例如 都放到documents下 cd users mac documents nginx 1.5.9 sudo configure prefix usr local nginx with pcre pcre 8.33 sudo make sudo make i...

mac 搭建lnmp環境

brew 1.5 版本以後將 php 轉至 core 維護。today i d like to announce homebrew 1.6.0.the most significant changes since 1.5.0 are brew install python installing py...