1. 安装php 7.1
brew tap shivammathur/php
查看可安装版本
brew search php
安装指定版本(禅道适用PHP运行环境(7.0/7.1/7.2版本))
brew install php@7.1
环境配置
vim ~/.zshrc
export PATH="/usr/local/opt/php@7.1/bin:$PATH"'
export PATH="/usr/local/opt/php@7.1/sbin:$PATH"'
export LDFLAGS="-L/usr/local/opt/php@7.1/lib"
export CPPFLAGS="-I/usr/local/opt/php@7.1/include"
source ~/.zshrc
验证版本
php -v
2. 安装apache
brew install httpd
brew install lynx
启动apache服务
brew services start httpd
sudo apachectl status
Apache 服务器命令
sudo apachectl start //开启Apache服务 sudo apachectl stop //停止Apache服务 sudo apachectl restart //重启Apache服务
sudo apachectl start
浏览器访问http://localhost:8080/,"It works!"表示服务已启动
验证版本
httpd -v
或者
sudo apachectl -v
3.
创建自己的证书,用来给PHP的 libphp.so 文件签名
将 php的libphp7.so(路径:/usr/local/Cellar/php@7.1/7.1.33_10/lib/httpd/modules/libphp7.so) 添加到apache中
sudo vi /usr/local/etc/httpd/httpd.conf
source /usr/local/etc/httpd/httpd.conf
重启apache
sudo apachectl restart
访问http://localhost:8080/