Mac PHP Random

Homebrew PHP Upgrade: “configure: error: Cannot find libz”

I was routinely upgrading my packages on Homebrew when I ran into the following error:

$ brew upgrade
==> Upgrading 1 outdated package, with result:
homebrew/php/php70 7.0.4
==> Upgrading homebrew/php/php70
==> Downloading
Already downloaded: /Library/Caches/Homebrew/php70-7.0.4
==> ./configure --prefix=/usr/local/Cellar/php70/7.0.4 --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc/php/7.0 --with-config-file-path=/usr/local/etc/php/7.0 --wi
Last 15 lines from /Users/johnro/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

Of course, I did the first thing I always do when running into an error, Google it! And I found this link that suggested running the following:

$ xcode-select --install

After that,

$ brew upgrade

ran fine.