第一步:
brew install php71 --with=apache
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew unlink php56
brew install php71 —with=apache
第二步:
If you wish to swap the PHP you use on the command line, you should add the following to ~/.bashrc,
~/.zshrc, ~/.profile or your shell's equivalent configuration file:
export PATH="$(brew --prefix homebrew/php/php71)/bin:$PATH"
第三步:
在 /usr/local/etc/apache2/2.4/下的http.conf中添加如下内容:
LoadModule php7_module /usr/local/Cellar/php71/7.1.0-rc.5_9/libexec/apache2/libphp7.so
<FilesMatch .php$>
SetHandler application/x-httpd-php
</FilesMatch>
<IfModule unixd_module>
第四部: 安装mysql 。
安装包是: mysql-5.7.16-osx10.11-x86_64.dmg
安装完后会有 如下提示:
2016-11-09T08:30:02.879012Z 1 [Note] A temporary password is generated for root@localhost: mmf4uk>k>&wG
If you lose this password, please consult the section How to Reset the Root Password in the MySQL reference manual.
记录下安装包自动生成的密码:mmf4uk>k>&wG
。
在 /usr/local/myql/bin 下面,通过 ./mysql –uroot –p 登陆终端:
操作的时候发现,需要修改密码,命令如下: SET PASSWORD = PASSWORD('projectx2015');
因为 通过pkg安装mysql,没用自动更新path路径,所以需要手动更新下path。
在~/.bashrc中添加
export PATH="/usr/local/mysql/bin:$PATH"
然后执行: source .bashrc 即可。