mac搭建mnmp环境

brew安装nginx

brew install nginx

安装php56

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
posted @ 2018-04-14 23:52  spectrelb  阅读(848)  评论(0编辑  收藏  举报