MAC NGINX PHP XDEBUG

1. 安装 homebrew
2. 安装nginx ; 终端运行 brew install nginx;
  1)给nginx 设置管理员权限:如果不设置管理员权限,80端口是不能监听的;
    #这里的目录根据你实际安装的目录来填写,默认是这个目录,不同的只是nginx的版本号而已
    sudo chown root:wheel /usr/local/Cellar/nginx/1.10.1/bin/nginx    
    sudo chmod u+s /usr/local/Cellar/nginx/1.10.1/bin/nginx
  2)加入launchctl启动控制
    mkdir -p ~/Library/LaunchAgents
    cp /usr/local/opt/nginx/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents/
    aunchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
   3)运行nginx 
    sudo nginx #打开 nginx
    nginx -s reload|reopen|stop|quit  #重新加载配置|重启|停止|退出 nginx
    nginx -t   #测试配置是否有语法错误
3. 安装PHP
  1) 安装
    brew tap homebrew/dupes
    brew tap josegonzalez/homebrew-php
    安装成功后,就是对php的配置了,因为mac默认是自带php的,所以我们要把我们安装的php加到环境变量里,
    而不是继续使用mac自带的php
  2) 设置
    sudo vim ~/.bash_profile
    #在这个文件最后添加下列语句:
    export PATH="$(brew --prefix php56)/bin:$PATH"
    #保存文件后,source下这个文件,使刚刚添加的环境变量生效
    source ~/.bash_profile
  3)加入launchctl启动控制
    mkdir -p ~/Library/LaunchAgents
    cp /usr/local/opt/php56/homebrew.mxcl.php56.plist ~/Library/LaunchAgents/
    launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
  4)配置文件路径
    /usr/local/etc/php/5.4/php.ini
    /usr/local/etc/php/5.4/php-fpm.conf
4 安装XDEBUG
  brew install php56-xdebug -fs
  配置ext-xdebug.ini文件
  重启PHP 
 
posted @ 2017-04-01 14:28  jackieron  阅读(279)  评论(0编辑  收藏  举报