Welcome to WebmasterWorld Guest from 18.104.22.168 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
How do you use PHP GZIP compression? An implementation question. Oaf357 msg:1290481 2:04 am on Jun 8, 2003 (gmt 0) I use PHP across all the page on my web site. Sometimes the ONLY reason is use PHP is for the ob_gzhandler.
I'm pretty sure my implementation of it works in compressing the entire page (GZIP tests show that it does) I'm just curious as to how other PHP users are utilizing ob_gzhandler.
For example, if I have a web page with no PHP elements on it (other than ob_gzhandler) I put this at the top of the page:
<?php ob_start ("ob_gzhandler");?>
Does this compress the entire page? It would appear so. But, I'm still curious how others are using PHP GZIP compression on their sites.
Thanks in advance for any comments.
daisho msg:1290482 2:42 pm on Jun 8, 2003 (gmt 0)
Not sure what you mean. I use this in all my programs to save bandwidth. You may want to look into the mod_gzip apache module if you make a static page a PHP page _just_ to use ob_gzhandler. It would be less overhead for you.
Storyteller msg:1290483 1:29 pm on Jun 9, 2003 (gmt 0)
Oaf357, yes, this will compress the entire page. However, the problem with ob_gzhandler is that it doesn't cache compressed output inflicting unnecessary server load. mod_gzip does. jamie msg:1290484 1:34 pm on Jun 9, 2003 (gmt 0)
doesn't cache compressed output
storyteller - what do you mean by that?
<added> do you mean that you can not use ob_gzhandler in conjunction with a caching system (phpCache for instance)?
Storyteller msg:1290485 3:35 am on Jun 13, 2003 (gmt 0)
What I was trying to say is that with ob_gzhandler your content get re-compressed every time it's served. mod_gzip keeps compressed content in a special directory, effectively caching it. mischief msg:1290486 10:42 pm on Jun 18, 2003 (gmt 0)
Read [ ...] php.net
One way to do it is with a .htaccess file including "php_value zlib.output_compression On".