Home » Web

Speeding up the site by using PHP GZIP compression

By: Zhiqiang Ma On: Feb 20, 2010 Views: 59 No Comment Print Email
Tags: , , ,

Compression is a simple way to speed up the site. PHP’s gzip compression is excellent. And using it is very convenient:

Simply put these codes before any HTML content at the beginning of the PHP script:

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

In WordPress, the suitable position for these codes is the beginning of the header.php file of the theme.

Read more:

Digg del.icio.us Stumble Techorati Facebook Newsvine Reddit Twitter
Mixx LinkedIn Google Bookmark Yahoo Bookmark MySpace LiveJournal Blogger RSS feed
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.