Item Upon
#1 in Business Subscribe Email Print

You are here: Home > Internet and Businesses Online > Web Development > Content Compression Using PHP

Tags

  • method
  • packets
  • significant
  • compressed content
  • maximum compression
  • midrange value

  • Links

  • Dry Skin Care - Nature's Miracle Dry Skin Treatment, Improvement Guaranteed In Seven Days Or Less
  • Three Small Words- One Huge Relief
  • Body Hair Removal: Solutions for Today
  • Item Upon - Content Compression Using PHP

    Limited Liability Company Act
    In 1977, Wyoming became the first state in the U.S. to enact Limited Liability Company (LLC) legislation. This new type of business entity attracted a great deal of attention, and other states started following Wyoming’s example.After a decade, the Internal Revenue Service declared that LLCs would be taxed on the lines applicable to partnerships. This provided the LLC a combination of the limited liability of a co
    yip.org/mod_gzip_test shows you the original and compressed content sizes for any page you submit. It also tells you if your content is compressed - good for checking if your settings are working.

    The PHP manual recommends using this method over the next method.

    Note: You can only enable zlib.output_compression in your php.ini file, even though the PHP documentation suggests otherwise.

    Usi

    How Building a Fanbase will Make You Sales
    If you've ever been to a popular forum hosted by a singal indivual, you would probably notice that most of the members of said forum take the owner or moderators advice as gold. Allan Gardyne is a good example of this, with his affiliate advice forum. Whenever he posts, people listen and will actively revolve their own decisions around his.Think of it this way, you build up a huge site, where you discuss and relea
    HTTP 1.0 introduced the idea of content encodings. A browser/client can notify the server that it can accept compressed content by sending the Accept-Encoding header. The Accept-Encoding header can be set as follows

    Accept-Encoding: gzip,deflate

    or with just one of gzip or deflate. You don't need to worry about any of this - PHP will automatically choose the correct compression to use.

    Compressing content usually results in less data being send across the network. This has three benefits:

    • Bandwidth usage decreases - you can serve more visitors before you reach your bandwidth limit
    • Network latency can be reduced because fewer packets will be used to transmit the data. Your application can appear faster to a user - page load times are reduced.
    • compressing files allows you to format your xhtml code for readibility without sacrificing page load times.

    There are two methods to using compression in PHP:

    Using zlib.output_compression
    Your PHP needs to be built with the zlib extension. In your php.ini file set

    zlib.output_compression = On

    to enable compression. You also need to make sure zlib.output_handler is empty.

    You can change the level of compression by using

    zlib.output_compression_level = d

    where d is a digit from 1(minimal compression) to 9(maximum compression). The higher compression levels increase CPU usage, possibly without any significant reduction in content size. Probably best to use a midrange value like 5. Or you can test different values and compare the content compressions. whatsmyip.org/mod_gzip_test shows you the original and compressed content sizes for any page you submit. It also tells you if your content is compressed - good for checking if your settings are working.

    The PHP manual recommends using this method over the next method.

    Note: You can only enable zlib.output_compression in your php.ini file, even though the PHP documentation suggests otherwise.

    Usi

    Over 40? What's Next With Your Work, Your Life?
    What would your perfect life’s work be?In mid-life, it’s a question we seldom ask. It could be the one question that saves you from lackluster jobs, faceless bosses and endless commutes.Are you stuck out of fear?This happens to many people when we pass 40. We get stuck in habit, routines and day to day living.What are you afraid of?Probably the things most of us fear; damage to our rela
    tent usually results in less data being send across the network. This has three benefits:
    • Bandwidth usage decreases - you can serve more visitors before you reach your bandwidth limit
    • Network latency can be reduced because fewer packets will be used to transmit the data. Your application can appear faster to a user - page load times are reduced.
    • compressing files allows you to format your xhtml code for readibility without sacrificing page load times.

    There are two methods to using compression in PHP:

    Using zlib.output_compression
    Your PHP needs to be built with the zlib extension. In your php.ini file set

    zlib.output_compression = On

    to enable compression. You also need to make sure zlib.output_handler is empty.

    You can change the level of compression by using

    zlib.output_compression_level = d

    where d is a digit from 1(minimal compression) to 9(maximum compression). The higher compression levels increase CPU usage, possibly without any significant reduction in content size. Probably best to use a midrange value like 5. Or you can test different values and compare the content compressions. whatsmyip.org/mod_gzip_test shows you the original and compressed content sizes for any page you submit. It also tells you if your content is compressed - good for checking if your settings are working.

    The PHP manual recommends using this method over the next method.

    Note: You can only enable zlib.output_compression in your php.ini file, even though the PHP documentation suggests otherwise.

    Usi

    How To Create Content That Will Get You Loads Of Links
    Did you know that there is a way that you can actually create content that will help generate plenty of relevant and valuable one way links pointed at your site? In the same way that articles can be written with the objective of getting as many readers as possible to click through the links in the resource box at the bottom of an article, you can also specifically write content with links in mind.The accumulation
    for readibility without sacrificing page load times.

    There are two methods to using compression in PHP:

    Using zlib.output_compression
    Your PHP needs to be built with the zlib extension. In your php.ini file set

    zlib.output_compression = On

    to enable compression. You also need to make sure zlib.output_handler is empty.

    You can change the level of compression by using

    zlib.output_compression_level = d

    where d is a digit from 1(minimal compression) to 9(maximum compression). The higher compression levels increase CPU usage, possibly without any significant reduction in content size. Probably best to use a midrange value like 5. Or you can test different values and compare the content compressions. whatsmyip.org/mod_gzip_test shows you the original and compressed content sizes for any page you submit. It also tells you if your content is compressed - good for checking if your settings are working.

    The PHP manual recommends using this method over the next method.

    Note: You can only enable zlib.output_compression in your php.ini file, even though the PHP documentation suggests otherwise.

    Usi

    First-Timers Tips For Networking Meetings
    So, there you are, standing outside the hall, listening to the hubbub of voices from within and wishing you were just about anywhere on earth apart from that spot right now. The first few times you go to a networking meeting are pretty nerve-wracking and it helps to go in with a few ideas and a plan for the event. That way, it reduces your stress, makes you more effective, and means that you can feel much more relaxed on
    /p>

    zlib.output_compression_level = d

    where d is a digit from 1(minimal compression) to 9(maximum compression). The higher compression levels increase CPU usage, possibly without any significant reduction in content size. Probably best to use a midrange value like 5. Or you can test different values and compare the content compressions. whatsmyip.org/mod_gzip_test shows you the original and compressed content sizes for any page you submit. It also tells you if your content is compressed - good for checking if your settings are working.

    The PHP manual recommends using this method over the next method.

    Note: You can only enable zlib.output_compression in your php.ini file, even though the PHP documentation suggests otherwise.

    Usi

    How To Increase Your Page Rank
    Increasing or improving your page rank is critical for the success of any low traffic site.There are two effective ways of improving a site's page rank in the shortest time possible. The first is to create valuable content and post it at high traffic, high ranking article directories.The second is to acquire links pointing at your low traffic site. Reciprocal links will not quite work and what you really ne
    yip.org/mod_gzip_test shows you the original and compressed content sizes for any page you submit. It also tells you if your content is compressed - good for checking if your settings are working.

    The PHP manual recommends using this method over the next method.

    Note: You can only enable zlib.output_compression in your php.ini file, even though the PHP documentation suggests otherwise.

    Using ob_start
    The disadvantage with zlib is you need access to the php.ini file, if zlib.output_compression is not already enabled (phpinfo() can show you if its enabled). Some ISPs do not give you access to the php.ini file.

    You can use PHP's output buffering to compress your pages. In your scripts, or on the page you want compressed, add the following line

    ob_start('ob_gzhandler');

    This should be at the very top of your scripts. It needs to be called before any content is send to the browser/client. If you have an include file that you use for all your pages, you might want to put this line at the top of that file.

    This will put all output in PHP's output buffer. At the end of the script, the function ob_gzhandler is called. This callback function determines the compression to use ('deflate' or 'gzip'), and compresses the content. The compressed content is then send to the browser/client.

    Conclusion
    You have seen two methods of compressing content using PHP with very little effort on your part. I have seen page sizes reduced by up to 68% using these methods. Not bad for one line of code!

    HTTP = HTML link (for blogs, profiles,phorums):
    <a href="http://www.itemupon.com/article/86509/itemupon-Content-Compression-Using-PHP.html">Content Compression Using PHP</a>

    BB link (for phorums):
    [url=http://www.itemupon.com/article/86509/itemupon-Content-Compression-Using-PHP.html]Content Compression Using PHP[/url]

    Related Articles:

    Networking Your Way to Success in Seven Easy Steps

    Affiliate Marketing Mistake 6- Not Protecting Your Affiliate Links

    Web & Graphic Design - Get It Done Right the First Time

    Bookmark it: del.icio.us digg.com reddit.com netvouz.com google.com yahoo.com technorati.com furl.net bloglines.com socialdust.com ma.gnolia.com newsvine.com slashdot.org simpy.com shadows.com blinklist.com