DISQUS

DISQUS Hello! Elliott Back's Blog is using DISQUS, a powerful comment system, to manage its comments. Learn more.

Community Page

Jump to original thread »
Author

Http Gzip Compression in PHP — Elliott C. Back

Started by elliottback · 8 months ago

No excerpt available. Jump to website »

7 comments

  • Thanks! It worked just fine for me
  • "What does this mean for your users? Faster loading websites and less latency."

    Just wanted to note that this really depends - while the file will obviously transfer faster, being much smaller in size and taking less bandwidth, often it will actually take longer for the page to load as the content must be decompressed after transfer. More info is available on php.net.
  • Thanks!

    Damn this is good.

    It reduced the page size from 9 k to 2 k.
  • ob_start(”ob_gzhandler”);

    This doesn't work for me.

    And, Andreas, having in mind what Dustin wrote and the fact that, as well as decompression, compression also takes time, you should really compress everything. For instance, I have a 4 kB dynamic page. Sure I am not going to compress it. What's the purpose? It's not going to load faster...
  • I don't see my previous comment but I suppose it will pop out eventually. Anyway, I have a minor addition to it. The first recommendation (with .htaccess) works for me, the second doesn't. I had to point this out because someone may think my VPS is incapable of doing any compression.

    The point of avoiding .htaccess in my case is that I don't wish to compress everything. I want just one include in the PHP file I wish to compress and nothing in others...
  • @Dustin :

    You probably have not been through details.

    Unless you have computer of 1970s, decompressing wont take any time (i mean negligible). But bandwidth and network technology can't compete with the CPU power.

    Conclusion:
    Its always better to use gzip, unless you expect very old version browsers to be used.
  • i got 500 internal server error after applying the code.
    dont know why!
    any thoughts??

Add New Comment

Returning? Login