phpenvまでのインストールはすんなりいくがPHPのインストールでコケがちなのでメモ
brew install bison re2c libxml2 zlib libzip libjpeg bzip2 \
curl libiconv libedit pkg-config krb5 tidy-html5 \
libpng icu4c oniguruma autoconf
してから.bashrcや.zshrcに以下の記述を入れる
export PATH="$(brew --prefix bison)/bin:$PATH"
export PATH="$(brew --prefix libxml2)/bin:$PATH"
export PATH="$(brew --prefix bzip2)/bin:$PATH"
export PATH="$(brew --prefix curl)/bin:$PATH"
export PATH="$(brew --prefix libiconv)/bin:$PATH"
export PATH="$(brew --prefix krb5)/bin:$PATH"
export PATH="$(brew --prefix openssl)/bin:$PATH"
export PATH="$(brew --prefix icu4c)/bin:$PATH"
export PATH="$(brew --prefix tidy-html5)/bin:$PATH"
export PKG_CONFIG_PATH="$(brew --prefix krb5)/lib/pkgconfig:$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig:$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH="$(brew --prefix icu4c)/lib/pkgconfig:$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH="$(brew --prefix jpeg)/lib/pkgconfig:$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH="$(brew --prefix tidy-html5)/lib/pkgconfig:$PKG_CONFIG_PATH"
export PHP_RPATHS="$(brew --prefix zlib)/lib $(brew --prefix bzip2)/lib $(brew --prefix curl)/lib $(brew --prefix libiconv)/lib $(brew --prefix libedit)/lib"
export PHP_BUILD_CONFIGURE_OPTS="--with-zlib-dir=$(brew --prefix zlib) --with-bz2=$(brew --prefix bzip2) --with-curl=$(brew --prefix curl) --with-iconv=$(brew --prefix libiconv) --with-libedit=$(brew --prefix libedit) --with-tidy=$(brew --prefix tidy-html5) --with-external-pcre=$(brew --prefix pcre2)"