As some of you may or may not have noticed, Bluehost has recently enabled gzip for all sites, at least on my server.
Normally this would not be a problem (and in fact it's great because loading times will be much smaller), but I had a script that required the output to be sent to the user as it was generated, not once the entire script was finished (otherwise known as output buffering). Gzip inherently buffers the output, so I had to find a way to disable it.
Thinking that mod_gzip was the problem, I tried adding "mod_gzip_on No" in my .htaccess file. Unfortunately, this gave me a 500 internal server error.
In a rather unhelpful response to my support ticket, one of the reps told me
So I also tried "mod_deflate_on No" in my .htaccess file, but that didn't work either.
Also, we don't have mod_gzip, but we do have
mod_deflate which is basically the updated version of this mod.
I finally stumbled upon the solution while searching on the Internet. Add this line to your .htaccess file:
If you want to turn off gzip for a specific file only, you can use this:
SetEnv no-gzip dont-vary
Obviously change MY_FILE_NAME to the name of the file.
SetEnvIfNoCase Request_URI MY_FILE_NAME\.php$ no-gzip dont-vary
This is working for me. It disables gzip compression and the accompanying output buffering. It should allow you to control output buffering via PHP if you want to, as well. :)
Since there's nothing mentioned in the knowledgebase, Bluehost no longer offers support for server/scripting issues via Live Chat (:mad:), and the ticket system wasn't very helpful on the issue, I thought I would post the solution here for future reference. Hopefully somebody benefits from it. :)