Themes

Categories

Archives

Meta

Make your directory Fly: How to GZIP Compress

Posted January 7th, 2009 by
Categories: straightguysca.com
  • I am not a programmer however I do have some tricks I can show to people that may not know how to speed up your directory. The answer is to use GZIP or compression technology like the big guys yahoo, msn, and google.

    how?
    You can easily shave off almost half of your bandwidth and download time for your directory using GZIPPING....

    most hosts use it if they use PHP....

    how to apply this "mod" :D (its the easiest of em all!):

    open index.php
    before ANY code add this:

    ob_start( 'ob_gzhandler' );
    ?>

    You are done!! To get a feel for how much speed you gained and bandwidth check:
    http://www.websiteoptimization.com/services/analyze/

    Compare before and after....

    I gzipped my css file to 1/3 its original size using two things:
    1)
    http://www.cssdrive.com/index.php/main/csscompressor/

    and
    2)
    then changing the css file type from .css to .php and adding
    ob_start ("ob_gzhandler");
    header("Content-type: text/css; charset: UTF-8");
    header("Cache-Control: must-revalidate");
    $offset = 60 * 60 ;
    $ExpStr = "Expires: " .
    gmdate("D, d M Y H:i:s",
    time() + $offset) . " GMT";
    header($ExpStr);
    ?>

    to the top of the php file

    Make sure you refer to the php (css) file in the following way:


    im done :D my first contribution...if you call it that :P

    KNOWN PROBLEMS: may influence MSN rankings? (not sure 100%) - please post here if you know anything about Gzipping and MSN SERPS


  • What to say, i just had to ask them!


    Hello [...],

    Thank you for writing to Live Search Technical Support. My name is Ma*ric*hu and I understand that you are inquiring about GZip Compression.

    your information is accurate and we do not currently support GZip Compression.

    We appreciate your continued support as we strive to provide you with the highest quality service available. Thank you for using Live Search.

    Sincerely,

    Ma*ric*hu
    Live Search Technical Support



    (i put stars in the name so it doesnt get googled, and removed mine:p)


  • nice work dude :)

    its better by 60%


  • when this was enabled on 3.0.5 i had description errors from search results :(


  • Okay thanks...so I got that I just create a file called php.ini using like notepad and put in the gzip line, but do I need to have anything else in the php.ini. If i just have that gzip thing in there it won't mess up anything else with my php files right? Just making sure because this is the first real time I've used php is with this directory. Sorry if this sounds stupid... :)


  • Wow, what huge site speed increase! Thanks!


  • I would say yes for the most part.
    The main thing I don't like about gzipping right now is MSN's search engine can't seem to read gzipped pages. Stupid I know, but what else can I say?
    are you 100% sure on this one or just using an0n's experience
    should i implement it?


  • I noticed a HUGE difference in my Directory. Thanks for the post.


  • It can be done also from your .htaccess file:
    php_flag zlib.output_compression On
    php_value zlib.output_compression_level 5

    But make sure your hoster and webserver allows it, else you'll get a 500/Internal Server Error if it's disabled.

    Boby


    cool! that is easier


  • Interesting...I will have to test this for 3.0.
    I'm starting to get the dev area setup, and soon we'll start combing the forums for miscellaneous bug fixes and improvements.


  • IMHO never compress I learned the hard way leave it where it is and just have Dawzz cache it


  • My directory's load time decreased from 4 seconds to 0,38 seconds.This is amazing.Awesome! Well Done.


  • ya, i get a lot of traffic from msn, so I had to disable this :(


  • James, any word on that adodb caching how-to giude? :)


  • Excellent,
    Thank you.


  • I was highly pissed off because I was ranked 5th on msn for some extreeeeemely high searched keyword phrases, and now because of the compression, my title is 1. borked to hell 2. I am nowhere in site now.
    I was doing between 4-600 in ypn a month and now i barely hit 100.

    grrrrrr


    hmm are u serious? **censored****censored****censored****censored**. Msn better wake up this is important to speed up the net. I never thought of SEO implications although I consider myself a pretty good SEOer... sorry for this :(


  • oh sorry i forgot about Dargre :) *and of course David lol*
    but anyways, i believe Dawzz uses files to cache with, but i could be wrong....whatever it is he does it has helped a lot on peoples sites...


  • msn chokes on it. If you enable it and your server is already trying to compress pages your going to get garbled text etc etc

    IF you site is getting slammed and you can follow basic instructions on use I can cahce your site and speed it up to the point you think it is static.


  • Could the function to use gzip in our directories be modified to create static html pages in a cache. This would be very helpful for high traffic sites.

    I've found this code but I can't get it to work with phpld

    http://www.ilovejackdaniels.com/php/caching-output-in-php/

    I've used this type of thing on other projects and it really made a different to the crawlability of the site and response times are just slashed to pieces.

    Cheers,

    Dave


  • You're my hero!

    I'm on dialup and my directory just literally loaded in 2 seconds!


  • @ mystickcal

    Just create a file called php.ini in your public_html but it would maybe also work in the root folder of your directory.
    Add following code to it:
    zlib.output_compression = 4KB

    I had no time to test it, but I hope it works, I got this from the php.ini reference.
    More help maybe here:
    http://www.php.net/manual/en/ini.php#ini.list


  • Is this Gzip mod the same as the Compress output: feature used on 3.1?


  • MSN lists a lot of junk and it seems unpossible to remove them from their index. My little website has a lot of pages indexed that are actually no pages...just internal links to some standalone scripts.


    google does the same thing to me...i have a foamy fan site and it lists all of my flash files :rolleyes:

    anyways lol thanks for the .htaccess trick...though it didn't seem to really speed up anything lol
    I tested the loading speed with
    Summit Media Spider Simulator (http://tools.summitmedia.co.uk/spider/)
    my directory went from 2 seconds to 1 second :p but hey every little bit helps *and before ya say anything...yes i just started the directory, however i've got like 250 links to it...yeah yeah not much i guess comparitively :o


  • works for me, thank you :)


  • :D you are welcome ! I am trying to give back to this great community...

    it works in other php documents too such as your main pages also...

    all the best


  • thanks for that msolution :)

    i think they may have lied though cuz i have php_flag zlib.output_compression On
    php_value zlib.output_compression_level 5 in my .htaccess on my adult directory but yet it's still indexed by msn.


  • glad everyone likes it!

    the cool thing is it works for people that have browsers enabled for compression ie 99% of them, the rest the server just serves up the un-compressed copy so need to worry about losing visitors...

    :D


  • yeah that is what I am doing. Am I prepared to post a how to... not yet.

    You can do it yourself by researching adodb caching or let me do it and you report back anything you run into problem wise. I truely dont think there are any :)


  • MSN lists a lot of junk and it seems unpossible to remove them from their index. My little website has a lot of pages indexed that are actually no pages...just internal links to some standalone scripts.
    well.. that definately isn't something i wanted to read ;((

    hopefully they fix it.


  • I see that it was said that you can do this all from your php.ini file. I looked on my hosting and didn't see a php.ini file. I called my hosting and they said you can do it, you just have to make your own using like notepad. My question is what all goes in this ini file? They told me to goto php.net to find out, but I couldn't find anything about .ini files that I understood lol.
    The post right above your tells you exactly what to put in yout .htaccess file.


  • Very good! According to http://www.websiteoptimization.com/services/analyze/ my home page went from 19 seconds to 12 seconds for the slowest (14.4) connection speed after making this change.


  • MSN lists a lot of junk and it seems unpossible to remove them from their index. My little website has a lot of pages indexed that are actually no pages...just internal links to some standalone scripts.


  • Question?:
    http://in.php.net/ob_gzhandler

    says:All browsers are supported since it's up to the browser to send the correct header saying that it accepts compressed web pages. If a browser doesn't support compressed pages this function returns FALSE.

    so ... does msnbot send these headers!, if it does, whats the issue!

    M.


  • :D :D him, boby, anon, VSDan, proprod :D :D they can all have free reign on my directories lolol so far the only ones have been Dawzz, an0n and Dargre but if I need the others I would use them as they are trusted:D


  • :) love to see people using it!


  • great post i didn't use it for phpLD but another php script
    the result was great thank you


  • I see that it was said that you can do this all from your php.ini file. I looked on my hosting and didn't see a php.ini file. I called my hosting and they said you can do it, you just have to make your own using like notepad. My question is what all goes in this ini file? They told me to goto php.net to find out, but I couldn't find anything about .ini files that I understood lol.


  • David, I was thinking the same thing.

    :)

    later


  • no problem dude :)

    lol at least someone finds my mod still finds it helpful... they actually included it sometime back in phpld 2.x something (paid only i think) in the admin panel.

    no offense but yahoo and msn suck at getting my pages no matter if i gzip or not. Google has no problem with gzipping whatsoever. I still use gzipping on most of my sites even non-phpld pages. Even joomla does too...


  • The post right above your tells you exactly what to put in yout .htaccess file.

    hey anon, do you still think its gzip compression that made you lose MSN rankings?

    I think its **censored****censored****censored** if its true as I believe MSN even uses gzip compression... their spiders really suck if true!


  • with mine I believe it was files as I am not sure as he has free reign in my directories if he needs to fix something pm him and he will let you know


  • MSN does NOT like compression.

    Google and Yahoo had no problems, but msn... no go.


  • You can do it from php.ini for every PHP script easily, just edit your php.ini and find zlib.output_compression and set it to On like:
    zlib.output_compression = On
    Don't touch anything else, and restart your Apache.

    Cheers


  • ya, i get a lot of traffic from msn, so I had to disable this :(
    I was highly pissed off because I was ranked 5th on msn for some extreeeeemely high searched keyword phrases, and now because of the compression, my title is 1. borked to hell 2. I am nowhere in site now.
    I was doing between 4-600 in ypn a month and now i barely hit 100.

    grrrrrr


  • David had at one point mentioned query caching for some of the people on the forum. Can anybody elaborate on that?


  • Is this Gzip mod the same as the Compress output: feature used on 3.1?

    I would say yes for the most part.
    The main thing I don't like about gzipping right now is MSN's search engine can't seem to read gzipped pages. Stupid I know, but what else can I say?


  • I am not sure as he has free reign in my directories
    :D :D him, boby, anon, VSDan, proprod :D :D they can all have free reign on my directories lolol


  • hey anon, do you still think its gzip compression that made you lose MSN rankings?

    I think its **censored****censored****censored** if its true as I believe MSN even uses gzip compression... their spiders really suck if true!
    I am uncertain at this point. My rankings have climbed back up again and I am listed top 5 for some great key terms. Still the problem of the garbled description remains. How in the hell do I get it out is beyond me. Their sipder visits my site enough to be able to correct it, but they seem to be taking their sweet time abotu it. *sigh*


  • version 3.2?

    3.3 is built in.


  • Dave, can you elaborate a little on your point about making a difference on the crawlability? Exactly how?


  • It can be done also from your .htaccess file:
    php_flag zlib.output_compression On
    php_value zlib.output_compression_level 5

    But make sure your hoster and webserver allows it, else you'll get a 500/Internal Server Error if it's disabled.

    Boby


  • What method does Dawzz use for caching? Is it on the database side?


  • Right, I saw the .htaccess file one, but I can't do it that way. My hosting company doesn't allow me to. I know before you say switch hosting companies they are paid for like a year so I really don't want to do that.


  • if i add the line in my index i get:

    Warning: ob_start(): output handler 'ob_gzhandler' conflicts with 'zlib output compression' index.php on line 4

    I asked my host already and i saw the php.ini...the compression is on and the level is 5. what i do wrong?







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Make your directory Fly: How to GZIP Compress , Please add it free.