How to fix libz error when installing php56 with Homebrew

When installing or upgrading PHP and crashing into this error that libz can not be found.

You can try to trigger Xcode to install the command line developer tools.

Usually you can run into errors like this when freshly installed Xcode or upgraded Xcode lately.
It is advised to start Xcode after installation or an upgrade to install the latest components.