On OS X El Capitan 10.11.4 I recently got the following error when trying to run my daily brew upgrade --all:

checking if the location of ZLIB install directory is defined... no
configure: error: Cannot find libz

This is actually an error I’ve received before, dating back to OS X 10.11. The solution is simple, I just ran:

    xcode-select --install
    brew upgrade --all

I can confirm that the above solution also works for homebrew packages of php54 as well as php70. If running those two commands didn’t work for you, I’ve heard some people have had to use brew reinstall php56 in order for php to find libz properly.

If this upgrade was triggered by a specific module, mcrypt in my case, you can validate that your modules are still active by running php -i "(command-line 'phpinfo()')" from your command line.