I'm having some issues running zlib compression on my site ..
Firstly if I enable zlib compression in .htaccess using: php_value output_handler ob_gzhandler then I receive thousands of lines of the following error:
PHP Warning: Cannot modify header information - headers already sent in Unknown on line 0
I have checked all files used for whitespace and any other characters that shouldn't be there with a hex editor but I could not get that error to subside with zlib turned on in .htaccess.
Therefore I have tried to turn zlib compression on in the php.ini file using:
zlib.output_compression "1"
zlib.output_compression_level "1"
However I'm now told by compression checkers that I have no compression turned on so it doesn't appear to be in the correct format?
ob_gzhandlerapproach requires you to buffer whole output, so that modified headers (that produced by that handler) will still be able to be sent (plus, the actual compressed content). Using webserver-level compression (see @msanford answer) is much better in this case as it happens after page was finished processing by php completely. – LazyOne Apr 26 '12 at 15:44