mac phpbrew安装

php 编译安装php 7.2.26

aliyun 镜像中心:https://developer.aliyun.com/mirror/

1、安装brew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
如果以上运行慢,可以使用:
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install > brew_install

修改文本:
BREW_REPO = “https://github.com/Homebrew/brew“.freeze
CORE_TAP_REPO = “https://github.com/Homebrew/homebrew-core“.freeze

更改为这两句

BREW_REPO = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git".freeze
CORE_TAP_REPO = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git".freeze

/usr/bin/ruby brew_install


# 替换brew.git:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
# 替换homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
# 应用生效
brew update
# 替换homebrew-bottles:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

Refer: https://developer.aliyun.com/mirror/homebrew?spm=a2c6h.13651102.0.0.3e221b1131Lyow
phpbrew update

brew install php

brew install phpbrew

下载php-7.2.26.tar.bz2 文件
cp php-7.2.26.tar.bz2 ~/.phpbrew/distfiles/

phpbrew install 7.2.26 +openssl=/usr/local/opt/openssl@1.1 +fpm +bz2=/usr/local/Cellar/bzip2/1.0.8 +zlib=/usr/local/Cellar/zlib/1.2.11

phpbrew switch 7.2.26

查看支持版本

phpbrew known --more

/usr/local/Cellar/php@7.2/7.2.26/bin/pecel install swoole ,在安装openssl 输入yes --with-openssl-dir=/usr/local/Cellar/openssl@1.1/1.1.1d
mysql时输入yes --with-mysql=/usr/local/Cellar/mysql-client/8.0.18

原文地址:https://www.cnblogs.com/a-xu/p/12362607.html