PHP
  Home arrow PHP arrow Using HTTP Compression in PHP: Make Yo...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Using HTTP Compression in PHP: Make Your Web Pages Load Faster
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 28
    2006-04-10

    Table of Contents:
  • Using HTTP Compression in PHP: Make Your Web Pages Load Faster
  • The basics of data compression: writing a simple "crunching" PHP script
  • Moving one step forward: using real HTTP compression on parsed PHP files
  • Compressing data by "Gzip:" defining the "getCompressedContent()" function

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using HTTP Compression in PHP: Make Your Web Pages Load Faster


    (Page 1 of 4 )

    Web developers are always looking for ways to reduce the loading time of their pages. This article, the first of three parts, shows you how to make PHP pages load faster by showing you how to compress dynamic PHP pages. Techniques covered include using PHP's built-in “gzencode()” function, along with output buffering control functions.

    Introduction

    Due to its inherent versatility, PHP provides developers with the ability to develop different mechanisms for reducing the loading time of parsed PHP pages. When it comes to optimizing methods for making PHP pages load faster, I covered the topic across several articles, which have been previously published right here, on the prestigious Developer Shed network, ranging from how to develop an (X)HTML caching system, to implementing a MySQL result set caching mechanism.

    Of course, reducing the load time of parsed PHP pages isn't limited to developing caching systems of a different nature. There are many other techniques that can be used, either as standalone or integrated solutions, in order to tackle some performance issues and deliver quickly dynamic content.

    Admittedly, making web pages (static or dynamic ones) load quicker is actually a fine-tuning process, which involves not only using the caching methods that I mentioned before, but implementing other well-known approaches. These include optimizing CSS, JavaScript and Flash files, compressing images, and eventually the optimization of additional elements that might be requested together with a web document, like Java applets.

    While the previous optimization methods are used frequently during the development of a Web application, in order to reduce the amount of data transmitted across different HTTP requests, in general terms caching systems are aimed at decreasing the frequency that data is sent through a specific network (local networks, intranets, extranets or the Internet as a whole). However, are these techniques the only ones used to optimize web pages? Fortunately, the answer is a resounding No!

    Just in case you weren't aware of it, a few years ago most modern browsers began to support HTTP compression as a transparent layer. This can be extremely useful when looking for additional ways to reduce the amount of data transmitted between a Web server and a client. As a result, this technique also can be taken into account if you want to make your PHP pages load considerably faster.

    Since PHP offers a powerful built-in library for handling HTTP compressed data, over this series I'll explain the basics of working with HTTP-compressed PHP pages. I'll illustrate, with several code samples, different methods for compressing dynamic PHP pages. So, do you want to learn how to take advantage of HTTP compression in your own PHP applications? Right, start reading to find out how this is done!

    More PHP Articles
    More By Alejandro Gervasio


       · The first part of the series goes through the practical implementation of HTTP...
       · Excellent information there. There is a small bug in your function...
       · Thank you for posting your feedback and comments, and I'm glad to know the article...
       · Removing all line-breaks will mess text inside TEXTAREA or PRE tags.In other...
       · I don't understand the point of this article. PHP does all of this work for you when...
       · Thank you for your comments. What you say is true about TEXTAREA and PRE tags....
       · Thank you for commenting on this article. With reference to your question, certainly...
       · Thank you for finding the bug and your code fix we really appreciate it. We have...
       · Has anyone developed a fix for this issue yet? I'd like to strip whitespaces from my...
       · This is a response to a message posted on Friday, 16 Jun 2006, with reference to...
     

       

    PHP ARTICLES

    - Using Aliases and the Autoload Function with...
    - Authentication Scripts for a User Management...
    - Utilizing the Use Keyword for Namespaces in ...
    - Building a User Management Application
    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Sub Classing Exceptions in PHP 5
    - Building a Content Management System with Co...
    - Filters and Login Systems for Web Applicatio...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT