Whether to transparently compress pages. If this option is set
to "On" in php.ini or the Apache configuration, pages are
compressed if the browser sends an "Accept-Encoding: gzip" or
"deflate" header. "Content-Encoding: gzip" (respectively
"deflate") and "Vary: Accept-Encoding" headers are added to
the output.
In runtime, it can be set only before sending any output.

This option also accepts integer values instead of boolean
"On"/"Off", using this you can set the output buffer size
(default is 4KB).

Note:

output_handler must be
empty if this is set 'On' ! Instead you must use zlib.output_handler.

Apparently, there is a bug in certain versions of PHP with setting zlib.output_compression to "On" via ini_set:

<?phpini_set("zlib.output_compression", "On");?>

In some cases, it does not send the Content-type header and browsers won't know to decompress the contents before displaying. Instead, you can set it to the buffer size, which sends the correct header:

In the hopes this will help others - a hard to spot gotcha when implementing zlib.output_compression. if you use flush() anywhere in your script (even right at the end) the compression won't work - you need to let that happen automatically or it ends up being sent uncompressed.