Forum Moderators: coopster

Message Too Old, No Replies

zlib - having problems

mod_gzip - first page loads very slow - subsequent in blink of an eye

         

iggy99

11:20 pm on Jun 22, 2004 (gmt 0)

10+ Year Member



i am trying to mod_gzip my php site -

really goofy page load on initial "home page" load, after deleting all cached temp files and rebooting computer to test clean load - page takes over 2 minutes to load subsequent page loads form that slow loading page are in a blink of an eye...

at the top of my php file i have this:

<?php ini_set('zlib.output_compression_level', 3);
ob_start('ob_gzhandler');

also - subsequent page loads sometimes do not load all images....

suggestions?
many thanks

PS for url - sticky mail me

coopster

10:06 am on Jun 29, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You cannot use both ob_gzhandler() [php.net] and ini.zlib.output_compression [php.net]. Also note that using ini.zlib.output_compression [php.net] is preferred over ob_gzhandler() [php.net].

iggy99

1:29 pm on Jun 29, 2004 (gmt 0)

10+ Year Member



thank you for the note -- things are working now - seems gzip did not like loading more than one css file - so i combined them --

it is my understanding i am not usig "both"

rather the first line is setting the "level of compression" the 2nd line is enabling...

am i confused? is there some other way to do this? i have noticed on occasions the page is not rendered - only the gzip gode is displayed - and once in a great while some images do not load...

thoughts?

coho75

1:35 pm on Jun 29, 2004 (gmt 0)

10+ Year Member



I just recently gzipped my pages to decrease their load time. I used <?php ob_start("ob_gzhandler");?> Is this not the best way to go about this? If not, what is?

coho75

coopster

1:48 pm on Jun 29, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



The level is the compression level used for transparent output compression [php.net], so yes, it seems you are attempting to use both.

iggy99

1:55 pm on Jun 29, 2004 (gmt 0)

10+ Year Member



example...

ob_start(array('ob_gzhandler',9));

Does not work. The output size isn’t affected at all, stays the same.

ob_gzhandler compression level use zlib.output_compression_level, which is -1 per default, level 6.

To change the compression level on the fly, simply use ini_set:
<?php
ini_set('zlib.output_compression_level', 1);
ob_start('ob_gzhandler');
echo 'This is compressed at level 1';
?>

excerpt from [us4.php.net...]