phpbrewでphpインストール
Mac, Mojave.
https://github.com/phpbrew/phpbrew/wiki/Requirement にある手順
xcode-select --install brew install automake autoconf curl pcre bison re2c mhash libtool icu4c gettext jpeg openssl libxml2 mcrypt gmp libevent brew link icu4c brew link --force openssl brew link --force libxml2
のうち下3つはできないしやらないで、代わりにパス通しておく。それ以外は公式に記載のとおり進めた。
export PATH="/usr/local/opt/icu4c/bin:/usr/local/opt/icu4c/sbin:$PATH" export PATH="/usr/local/opt/openssl/bin:$PATH" export PATH="/usr/local/opt/libxml2/bin:$PATH"
今回はPHP5.xが必要だったので、インストールしようとしてみると、まだ必要なライブラリがいくつか足りないらしくエラーでる。
$ phpbrew install 5.6.40 +default ...(略) checking for BZip2 support... yes checking for BZip2 in default path... not found configure: error: Please reinstall the BZip2 distribution checking for cURL support... yes checking for cURL in default path... not found configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/
いくつかライブラリ追加と、インストール時にパス指定し、やりなおしてインストール成功。
$ brew install zlib bzip2 libiconv curl $ phpbrew install 5.6.40 +default +bz2="$(brew --prefix bzip2)" +zlib="$(brew --prefix zlib)" +curl="$(brew --prefix curl)" (略) Enjoy! $ phpbrew use php-5.6.40 $ php -v PHP 5.6.40 (cli) (built: Aug 25 2019 17:25:10) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies