NameSilo

Simple gz compression

Spaceship Spaceship
Watch

GeorgeB

Established Member
Impact
1
Want to use gz compression on your PHP pages to compress pages and save bandwidth without affecting performance?

Use the PHP ob_gzhandler callback function.

Here is an example of it's use:

Code:
<?php

ob_start("ob_gzhandler");

?>
<html>
<body>
<p>This should be a compressed page.</p>
</html>
<body>
That's right... a simple line at the beginning of your PHP file is all it takes! Try it yourself in your own custom, paid, or free PHP applications :)

Note: ob_gzhandler() requires the zlib extension.

More FREE helpful tutorials like this one at www.georgeboone.com
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Hey George, I use currently at my custom script one page only index.php which calls all other pages as includes depending on the 'mode' value. Do I input this line in the index page only? or the includes as well? ~

And it needs to become at the very top right below session_start(); ?
 
0
•••
Cool, didn't know that one! Thanks for sharing!
 
0
•••
oh! i hope i can use it any of my forum.
 
0
•••

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back