Jump to content

GZIP question


robert_gsfame

Recommended Posts

I have just googling in order to find out how to do GZIP so that user can load web page faster. n i found some article which stated that i have to put this script only.

 

<?php

ob_start( 'ob_gzhandler' );

?>

 

my question is...is it doing the zip?

if it is correct where should i put that script, in every page which is needed to be compressed or inside index page only?

 

thx in advance

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/212189-gzip-question/
Share on other sites

As I understand it, you have to put this on every page at the start before any output as it is using the buffer. Then at the end of the page you flush it out to display it on the browser.

 

I believe that Google webmaster tools has a section where you can see how long your web pages take to load and it analyses some of the image, ccs, and other files your pages call in order to produce your web page. Hope that helps a little bit.

 

 

so at the very top...

<?php
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start();

and then at the end

<?php ob_flush(); ?>

</body></html>

 

At least that what seems to work for me.

Link to comment
https://forums.phpfreaks.com/topic/212189-gzip-question/#findComment-1105990
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.