File compression?

JadeDragon
JadeDragon's picture

Joined: 2003-02-15
Posts: 332
Posted: Sun, 2003-08-17 16:38

Will G2 incorporate Zlib and/or Gzip compression for the output of the php files?

I have incorporated Gzip in 1.3.3 and notices a little improvement in output and halfed my bandwidth useage for php files.

=)
Jade

 
alindeman
alindeman's picture

Joined: 2002-10-06
Posts: 8194
Posted: Sun, 2003-08-17 18:21

As in output buffering? That sounds like a neat option..

If that's what you're talking about, the function is http://us3.php.net/ob_gzhandler which looks pretty neat-o ;)

 
JadeDragon
JadeDragon's picture

Joined: 2003-02-15
Posts: 332
Posted: Sun, 2003-08-17 22:23

Yes, that is exactly what I meant.

A couple things to be aware of though.

IF Zlib is enabled globally through the php.ini then you cannot use gzip. An If/Then statement will be needed. Zlib is the preferable way to compress output, but can cause problems with other applications which rely on gzip.

It's an either/or situation.

If you use gzip then you will have to end the cylce of compression before the next header is called. This can simply be done by using this code.

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

If you do not end/clean/flush the handler you will end up with this error

Quote:
Warning: (null)() [ref.outcontrol]: output handler 'ob_gzhandler'

PHP 4.3.x handles code a bit tighter than the previous versions which is good overall. This error occurs when the headers are being called more than once. The ob_end_clean() ends the previous compression cycle and ob_start("ob_gzhandler") starts the cycle again for the new page.

These are different than mod_gzip as that is not available across many hosts as it can be CPU intesive. Mod_gzip is only recommended to be used on dedicated servers for specific applications. The higher you set Mod_gzip then the more CPU is used.

=)
Jade

 
JadeDragon
JadeDragon's picture

Joined: 2003-02-15
Posts: 332
Posted: Tue, 2003-08-19 13:19

On another note: If this is implemented there will also need to have a way to turn it off in the admin panel.

=)
Jade

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sat, 2003-08-23 20:55

We will definitely provide this option in the future, but not right away (got bigger fish to fry!)

 
Oldhoj

Joined: 2006-02-12
Posts: 17
Posted: Sat, 2006-03-25 19:19

My CPU i really overloaded with gzip (index 88) ... do anyone have any ideas ... I have around 1500 users on the gallery, but dont know how to get that load down (almost gzip all of it )

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2006-03-27 00:42

make sure you're using gallery 2.1 and visit Site Admin / Performance
(reply to a 2.5 year old topic, nice..)