php56 nginx apache mysql环境搭建
by Ren Xin Qiang
删除自带php和Apache
http://zhidao.baidu.com/question/1446936138160793220.html
安装homebrew
/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
基于ruby开发的包管理工具 类似于linux的rpm,yum软件包管理工具
PHP
- 先安装 brew 可以去brew.sh官网安装
- 安装brew的php扩展
brew update
brew tap homebrew/dupes
brew tap homebrew/php
brew tap josegonzalez/homebrew-php
- 全部执行完毕之后 查看php56的所有模块 执行
brew options php56
- 如果出现报错
Error: Formulae found in multiple taps:
- homebrew/php/php56-redis
- josegonzalez/php/php56-redis
- Please use the fully-qualified name e.g. homebrew/php/php56-redis to refer the formula. 可以执行 brew untap josegonzalez/homebrew-php 命令重置josegonzalez/homebrew-php文件
- 安装php5.6 执行
brew install php56
命令 - 安装完毕后可以使用
brew info php56
查看php的配置文件和安装目录 - 重启PHP56 可用
brew services restart php56
nginx
- 搜索nginx是否存在
brew search nginx
- 安装nginx
brew install nginx
- 启动nginx 命令行执行
sudo nginx
- 浏览器输入localhost:8080出现
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org. Commercial support is available at nginx.com.
Thank you for using nginx.
代表nginx正常运行
mysql
-
brew install mysql
(安装) -
添加修改mysql配置 mysqld –help –verbose | more (查看帮助, 按空格下翻)
-
你会看到开始的这一行(表示配置文件默认读取顺序) Default options are read from the following files in the given order: /etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf 通常这些位置是没有配置文件的, 所以要自己建一个 ls $(brew –prefix mysql)/support-files/my-* (用这个可以找到样例.cnf)
-
cp /usr/local/opt/mysql/support-files/my-default.cnf /etc/my.cnf (拷贝到第一个默认读取目录)
-
按需修改my.cnf
-
brew services start mysql
(启动) -
brew services stop mysql
(停止)
apache
-
brew tap homebrew/apache
-
brew install httpd24
msmtp
Subscribe via RSS