Question

I've got a site that throws a Content Encoding Error in the browser if a ob_start('ob_gzhandler') is present. If I remove the statement, it runs fine.

  • The site runs off the same framework, server and hosting package as a number of other sites. They all work, regardless of if the statement is in there.
  • The statement is in the framework, not the application code, so it is shared by all of the sites.
  • There's no difference in the configuration between the working sites and non working site.
  • The site runs fine locally, using the exact same code and data.
  • You can fetch the site with curl / wget, and the HTML returned renders fine in a browser.
  • The response headers are exactly the same, with out without the statement.

I've now removed all of the code on the remote server, and re-uploaded everything. Still no change. The next step would be to re-install the site, and start from scratch, but I don't want to loose all of the data.

Any pointers, suggestions or solutions?

Was it helpful?

Solution

usually I do below and it works for me, give it a try

Write ob_end_clean(); or ob_flush(); at the bottom of the page where you start ob_start();

References:

ob_end_clean();

ob_flush();

OTHER TIPS

Just Put this line of code in starting and everything will be fine..

while (ob_get_level() > 0) { ob_end_clean() ; } 

If you're using Apache's gzip compression already (which by the looks of it you do, since CSS/JS are compressed as far as I can see), then using ob_start('ob_gzhandler') will compress that compression... and the browser won't be able to handle it.

I'm speaking under correction of course as I've always used Apache to do it for me, but it looks like you're double gzipping things, that's why it works without the "ob_gzhandler" statement.

Check your .htaccess files on the other sites and compare it with the site you're running that has the same problem as I can't see that you're running Drupal on zacoders.net and jadeit.co.za, just on jadeit.co.za which makes me think they're not the same framework as you said they are? shrug

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top