zoukankan      html  css  js  c++  java
  • Mac下使用brew搭建PHP7+nginx+mysql开发环境

    http://blog.csdn.net/mysteryhaohao/article/details/52230634

    HomeBrew

    brew的安装,直接上官网:http://brew.sh/ 

    一个命令就搞定:

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

    PHP7

    安装好brew之后,先安装php7。安装php7之前,要先更新一下brew的源并加入一些第三方的库:

    brew update

    brew tap homebrew/dupes

    brew tap homebrew/versions

    brew tap homebrew/homebrew-php

    然后就可以使用brew搜索php70的包并安装了

    brew search php70

    brew install php70

    至于php70的扩展安装,在search的时候就已经有扩展的列表的,按需安装,安装也很简单:

    brew install php70-redis

    The php.ini and php-fpm.ini file can be found in:
        /usr/local/etc/php/7.2/
    
    To have launchd start php now and restart at login:
      brew services start php
    Or, if you don't want/need a background service you can just run:
      php-fpm

    Nginx

    同php7一样:

    brew install nginx

    安装好后,如果要加入到自启动的话,要先添加一个文件夹:

    mkdir -p ~/Library/LaunchAgents

    然后把自启动的plist加入到这个文件夹内:

    cp /usr/local/Cellar/nginx/1.10.1/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents

    然后执行mac的launchctl命令就可以了:

    launchctl -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist

    如果把php也加入自启动的话,也是一样的吧Cellar/php下面的plist加入到LaunchAgents文件夹下并执行launchctl命令即可

    Docroot is: /usr/local/var/www
    
    The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
    nginx can run without sudo.
    
    nginx will load all files in /usr/local/etc/nginx/servers/.
    
    To have launchd start nginx now and restart at login:
      brew services start nginx
    Or, if you don't want/need a background service you can just run:
      nginx

    Mysql

    安装一样简单:

    brew install mysql

    安装好之后,执行mysql.server start

    这时候要记得,使用mysql_secure_installration来对mysql进行安全设置,包括设置root密码以及密码安全级别等

      We've installed your MySQL database without a root password. To secure it run:
        mysql_secure_installation
    
    MySQL is configured to only allow connections from localhost by default
    
    To connect run:
        mysql -uroot
    
    A "/etc/my.cnf" from another install may interfere with a Homebrew-built
    server starting up correctly.
    
    To have launchd start mysql now and restart at login:
      brew services start mysql
    Or, if you don't want/need a background service you can just run:
      mysql.server start
  • 相关阅读:
    P2634 [国家集训队]聪聪可可
    P2051 [AHOI2009]中国象棋
    java集成工具的简单总结
    java-web中的web.xml中的servlet和servlet-mapping标签,及网页处理流程
    ecplist中快速添加set get方法
    Spring创建容器之new ClassPathXmlApplicationContext错误
    设计模式之工厂模式
    java-web项目的eclipse里面引入jar包
    DES原理及代码实现
    Linux网络篇,ssh原理及应用
  • 原文地址:https://www.cnblogs.com/mitang/p/8081961.html
Copyright © 2011-2022 走看看