PDA

View Full Version : PHP compression feature?


Adagio
Sat 28th Apr '01, 5:34am
Hi,

I just wanted to ask if you have implemented the compression feature of PHP 4.0.4 into vBulletin.

If yes, great! :)

For those who don't know what it is:

ob_gzhandler() is intended to be used as a callback function for ob_start() to help facilitate sending gz-encoded data to web browsers that support compressed web pages. Before ob_gzhandler() actually sends compressed data, it determines what type of content encoding the browser will accept ("gzip", "deflate" or none at all) and will return it's output accordingly. All browsers are supported since it's up to the browser to send the correct header saying that it accepts compressed web pages

That means, if your browser supports receiving compressed data, you will receive the pages vBulletin creates much faster.

Currently, only IE 5.5 seems to support it.

Of course, it still works with other browsers, but the code won't be compressed then.

The usage is simple - just add this code on the very top:

<?php ob_start("ob_gzhandler"); ?>

JamesUS
Sat 28th Apr '01, 5:42am
gzip compression has been implemented, however not using the PHP default functions as they have known memory leaks.
The dev team have written their own functions for it :)

MattR
Sun 29th Apr '01, 12:59am
Originally posted by JamesUS
gzip compression has been implemented, however not using the PHP default functions as they have known memory leaks.
The dev team have written their own functions for it :)

I've been trading e-mails with Zeev Suraski (co-founder of Zend) and he confirmed that the ob_gzhandler functions are seriously messed up, specifically: "Another issue - the 4.0.4 version of PHP has a very poorly implemented output compression mechanism., which is known to consume huge amounts of memory. That of 4.0.5 (due very soon) is much more efficient."

I prefer the PHP.ini method simply because it means less code in each PHP file. :)