HomeBrew 安装 PHP7.1

$ brew update

$ brew tap homebrew/dupes

$ brew tap homebrew/php

$ brew update

$ brew install php71

一、安装常见问题:

1、找不到libphp7.so

HomeBrew 安装 PHP7.1(开发笔记)-LMLPHP

解决方法:

$ brew info php71            //查看信息

HomeBrew 安装 PHP7.1(开发笔记)-LMLPHP

$ brew install php71 --with-httpd24             //安装带模块

2、

HomeBrew 安装 PHP7.1(开发笔记)-LMLPHP

解决方法:

$ xcode-select --install

HomeBrew 安装 PHP7.1(开发笔记)-LMLPHP

二、安装成功:

HomeBrew 安装 PHP7.1(开发笔记)-LMLPHP

HomeBrew 安装 PHP7.1(开发笔记)-LMLPHP

演示:

bochaodeMacBook-Pro:~ MrZhao$ brew update

Already up-to-date.

bochaodeMacBook-Pro:~ MrZhao$ brew install php71 --with-httpd24

Updating Homebrew...

==> Installing php71 from homebrew/php

==> Installing dependencies for homebrew/php/php71: homebrew/apache/httpd24

==> Installing homebrew/php/php71 dependency: homebrew/apache/httpd24

==> Downloading https://homebrew.bintray.com/bottles-apache/httpd24-2.4.23_2.sierra.bottle.tar.gz

######################################################################## 100.0%

==> Pouring httpd24-2.4.23_2.sierra.bottle.tar.gz

==> Caveats

To have launchd start homebrew/apache/httpd24 now and restart at login:

brew services start homebrew/apache/httpd24

Or, if you don't want/need a background service you can just run:

apachectl start

==> Summary

04-13 13:54