Don't call echo before ob_gzhandler or you get ERR_CONTENT_DECODING_FAILED error

The ob_gzhandler will compress(gzip) the output after the its invocation, if you echo anything before the invocation for example the below

 
echo "hello";
ob_start('ob_gzhandler');
 

You will get ERR_CONTENT_DECODING_FAILED error, the reason is with the invocation of ob_gzhandler, the HTTP response tells the browser the content is compressed, but the response output before the invocation is not compressed which makes the whole response content invalid, the browser don't know it and treat it as compressed data, when it tries to decode or decompress the data, it fails.