<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MacdougalMedia &#187; Gzip</title>
	<atom:link href="http://macdougalmedia.com/tag/gzip/feed/" rel="self" type="application/rss+xml" />
	<link>http://macdougalmedia.com</link>
	<description>by Scott Macdougal Weaver</description>
	<lastBuildDate>Tue, 18 May 2010 10:56:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Compress PHP Output And Save On Bandwidth!</title>
		<link>http://macdougalmedia.com/2009/06/30/compress-php-output-and-save-on-bandwidth/</link>
		<comments>http://macdougalmedia.com/2009/06/30/compress-php-output-and-save-on-bandwidth/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 01:07:12 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Gzip]]></category>
		<category><![CDATA[zlib]]></category>

		<guid isPermaLink="false">http://macdougalmedia.com/?p=72</guid>
		<description><![CDATA[We all love web pages that load super fast and as Google pushes us to "make the web faster," we must heed the call.
In my search for ways to increase efficiency while decreasing page load times and bandwidth output, I happened upon the wonderful world of Zlib compression. This compression type uses gzip to compress [...]]]></description>
			<content:encoded><![CDATA[<p>We all love web pages that load super fast and as Google pushes us to "<a title="Google seeks faster web" href="http://www.infoworld.com/t/internet/google-seeks-faster-web-950" target="_blank">make the web faster</a>," we must heed the call.</p>
<p>In my search for ways to increase efficiency while decreasing page load times and bandwidth output, I happened upon the wonderful world of Zlib compression. This compression type uses gzip to compress the output of your files and feed them to the browser.</p>
<p>How cool is that?</p>
<p>While it might sound like it would be an impossible task, it's really as simple as doing two things-</p>
<p><strong>Step 1. Make sure your PHP server has the zlib extension</strong></p>
<p>All you have to do is create a file called something like <strong>phpinfo.php</strong> on your server and put the following code inside:</p>
<pre name="code" class="php">&lt;?php

phpinfo();

?&gt;</pre>
<p>Once it loads, just find 'zlib' and check to see whether it's there and whether it's enabled. If not, you need to either enable it yourself or ask your server admin to do it.</p>
<p><strong>Step 2. Pop in the code!</strong></p>
<p>Put the following code at the very top of any pages you want compressed, or (preferably) in your header file for the entire site-</p>
<pre name="code" class="php">&lt;?php

ini_set('zlib.output_compression', 'On');
ini_set('zlib.output_compression_level', '1');
?&gt;
</pre>
<p>OR if that doesn't work for you, you can try this-</p>
<pre name="code" class="php">&lt;?php

ob_start('ob_gzhandler');

?&gt;</pre>
<p>...that's it!</p>
<p>Now try reloading your page.</p>
<p>If everything went right, you should notice an improvement in load time and where you'll notice it most is in your bandwidth usage at the end of the month.</p>
<p>I tested the before and after on Sitdiary.net and the file got compressed by over 3X every time! In other words, I'm going to cut my bandwidth usage down by 2/3 on all PHP files.</p>
<p><span style="color: #ff0000;">*** </span><strong>UPDATE</strong> <span style="color: #ff0000;">***</span></p>
<p>On my Wordpress blogs, I've been testing this out on the index.php and it seems I'm getting upwards of 75% compression rates!</p>
]]></content:encoded>
			<wfw:commentRss>http://macdougalmedia.com/2009/06/30/compress-php-output-and-save-on-bandwidth/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

