Enable Gzip on Share Hosting in Right Way – Unix Like

WordPress No Comments

The tips for Gzip enabling on sharing hosts installed Unix like OS. I know many resources on Google.com can help you already. So this is not an full guide for enable Gzip. Although I have listed a dozen of tips at the end of this post. Read my story to understand what I wanna share with you. That’s an specific medicine for the guys who is dropping in the same situation I met.

Today, I did the optimization for the blog as usual after the blog(buy STO credit) has been set up. The blog is hosted by Godaddy Sharing Host(Specially, Linux economy plan. Why? As it’s cheap prices and decent CS. If you have any suggestion to me, I appreciate!). After the bog got a nice score with YSlow, I noticed that the title rewrite has been all death. I have used the famous WordPress plugin titled All in One SEO by Michael Torbert. Sincerely, I am so lazy so that I didn’t read the sources code ever. I have to read the code to understand how it works. aha..It uses the function ob_start() to get call callback function in the class to rewrite the original title. That’s where the collision comes from. I have used the ob_start(“gz_handler”) to enable Gzip for buystocredit.com. Read the PHP manual for function ob_end_flush() to know the collision well if you want to know more.
So, the issue I met when I enabled Gzip was clear.

What is the tip to fix?

  • Web Server: Apache 1.3.* with PHP5 on Linux Share Hosting
  • Blog Software: WordPress
  • Plugin Enabled: All in one SEO pack
  • Gzip Enabled Method: call ob_start(“gz_handler”) at the beginning of each page
  • Result: All in one SEO pack title rewrite disables
  • Solution: Use zlib.output_compression to instead of ob_gzhandler()
    1. Remove the ob_start(“ob_gzhandler”) from everywhere in your codes
    2. Modify the php5.ini/php.ini at the web root as following:zlib.output_buffering = On
      ;zlib.output_handler = ob_gzhandler //comment it out, as it cannot be used with the zlib.ouput_compression is on
      zlib.output_compression = On

There are many way to enabled Gzip as following.

Apache 2.0.x – if the mod_felate enabled by your host provider.
Enable Gzip via Mod_deflate
Apache 1.3.x – if the mod_gzip installed and enabled by your host provider
Official Mod_Gzip Manual or Fast Usage Tips
PHP 4.0.4 or higher Ob_start(“ob_gzhandler”)
Fast Effective PHP Gzip Compression
PHP zlib.output_compression
The method in my post!
Other resouces:
Gzip with .htaccess and PHP
Better Explained? Interesting domain

Leave a Reply

@ 2009-2014 - GGIN.Com
Entries RSS Comments RSS Log in