Welcome to WebmasterWorld Guest from 54.147.10.12

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

How do you use PHP GZIP compression?

An implementation question.

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

Preferred Member

10+ Year Member

joined:Mar 5, 2003
posts:636
votes: 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.

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

Preferred Member

10+ Year Member

joined:Jan 31, 2003
posts:457
votes: 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.

Serge.

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

Junior Member

10+ Year Member

joined:May 3, 2003
posts:159
votes: 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.
1:34 pm on June 9, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:July 24, 2002
posts:1124
votes: 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)?

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

Junior Member

10+ Year Member

joined:May 3, 2003
posts:159
votes: 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.
10:42 pm on June 18, 2003 (gmt 0)

New User

10+ Year Member

joined:Feb 9, 2003
posts:28
votes: 0


Read [php.net...]

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