Welcome to WebmasterWorld Guest from 23.22.46.195

Forum Moderators: coopster & jatar k

How do you use PHP GZIP compression?

An implementation question.

   
2:04 am on Jun 8, 2003 (gmt 0)

10+ Year Member



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.

2:42 pm on Jun 8, 2003 (gmt 0)

10+ Year Member



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.

Serge.

1:29 pm on Jun 9, 2003 (gmt 0)

10+ Year Member



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.
1:34 pm on Jun 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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)?

3:35 am on Jun 13, 2003 (gmt 0)

10+ Year Member



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.
10:42 pm on Jun 18, 2003 (gmt 0)

10+ Year Member



Read [php.net...]

One way to do it is with a .htaccess file including "php_value zlib.output_compression On".

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month