Mac——homebrew安装PHP环境

1.安装homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2.安装nginx

brew install nginx
nginx -s reload|reopen|stop|quit #重新加载配置|重启|停止|退出 nginx

  

nginx -t #测试配置是否有语法错误

如果提示pid丢失的话,就用这句话

nginx -c "/usr/local/etc/nginx/nginx.conf"

3.安装PHP7

brew install php70 --without-apache --with-fpm

  /usr/local/sbin/php5x-fpm {start|restart|stop}

4.安装mysql

brew install mysql 

  cp /usr/local/opt/mysql/support-files/my-default.cnf /etc/my.cnf

brew services start mysql (启动)
brew services stop mysql (停止)

5.添加到环境变量

vim /etc/profile

  

export PATH="/usr/local/Cellar/php@7.1/7.1.16_1/sbin:$PATH"

  

source /etc/profile

  

原文地址:https://www.cnblogs.com/xj76149095/p/7003029.html