Welcome to WebmasterWorld Guest from 18.104.22.168 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Pubcon Platinum Sponsor 2014
How do you use PHP GZIP compression? An implementation question. Oaf357
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.
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.
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
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)?
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
Read [ ...] php.net
One way to do it is with a .htaccess file including "php_value zlib.output_compression On".