Jump to content
xisto Community
Sign in to follow this  
Quatrux

Php And Gzip encoding using zlib

Recommended Posts

Well, as not such long time ago I found one thing, whuch in my opinion is very useful and i thought why didn't I know about it erlier..

I am talking about ob_gzhandler which requires zlib and on most as I remember its in the default and is available on the Xisto server too. A link to PHP dot net:

http://php.net/manual/en/function.ob-gzhandler.php

<?phpob_start("ob_gzhandler");?>

you should put this code somewhere in top, and use session_start() after it, it enables apache to send the file as application/x-gzip and it checks it self if the user/browser supports this encoding, also it turns on output buffering and you won't have problems with headers, browse more functions for ob_x() ..you ask if it does not slow the server ? well gzip is just perfect for html to compress all the same tags and apache needs to send much less size to the user and the default compression rate is 6 which does not slow the things at all, especially if the server is good, you save bandwidth and users gets the source much faster. Most popular browsers supports this and don't worry about the bots who might not understand this encoding, they will still get the html source.

here are some more links:

http://forums.xisto.com/no_longer_exists/

I remember to read that, so things might sound similiar. :mellow:
Just wanted to exchange knowledge.

Share this post


Link to post
Share on other sites

Thanks for the post. I've known about this but never bothered doing it to my site. I guess I was a bit worried about browser support. Now on this guy is compressing his documents. :)By the way I have heard that gzip compression causes some problems with CSS stylesheets. Is this BS?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.