Macを使って開発をしている人はhomebrewをお使いの人が多いと思います。
パッケージのダウンロードからインストールまで、コマンド一発で済むので便利ですよね。
最新のPHP7も下記のコマンドをターミナル上から打つだけで簡単に導入できます。
# php 7のインストール
brew update # update
brew install homebrew/php/php70 # install php7
export PATH="$(brew --prefix homebrew/php/php70)/bin:$PATH" #PATHを通す
折角インストールしたのはいいけど、homebrewを使ってPHPのアップデートをする際に
" error: Cannot find libz "とエラーが表示されて、アップデートが出来ない時があります。
$ brew upgrade
...
...
==> ./configure --prefix=/usr/local/Cellar/php70/7.0.3 --localstatedir=/usr/local/var --sysconfdir=/
Last 15 lines from /Users/YOURNAME/Library/Logs/Homebrew/php70/01.configure:
checking for OpenSSL support... yes
checking for Kerberos support... /usr
checking whether to use system default cipher list instead of hardcoded value... no
checking for krb5-config... /usr/bin/krb5-config
checking for RAND_egd... no
checking for pkg-config... no
checking for OpenSSL version... >= 0.9.8
checking for CRYPTO_free in -lcrypto... yes
checking for SSL_CTX_set_ssl_version in -lssl... yes
checking for PCRE library to use... bundled
checking whether to enable the SQLite3 extension... yes
checking bundled sqlite3 library... yes
checking for ZLIB support... yes
checking if the location of ZLIB install directory is defined... no
configure: error: Cannot find libz
READ THIS: https://git.io/brew-troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
https://github.com/Homebrew/homebrew-php/issues
上記のエラーは "libzというライブラリが見つかりません"という意味で
MacのXcodeをアップデートをした時に発生することがあります。
そういう時はターミナル上で下記のコマンドを打つと必要なライブラリが
インストールされ、問題なくPHPのアップデートできます。
xcode-select --install
"error: Cannot find libz"のエラーが出た時はゼヒ×2参考にしてください。