I downloaded Symfony and got this error. I rushed to build a new PHP, but that wasn’t the solution.
The fix was to edit the php/extensions.ini file, and add the extension to use zlib.
extension=zlib.so
PHP doesn’t use the libraries directly. It uses an extension (a PECL extension), which may be loaded dynamically, to provide the glue and PHP functions to make calls to the shared library.