PHP
  Home arrow PHP arrow Output Caching with PHP
Dev Shed Forums 
Administration  
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 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
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

Output Caching with PHP
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 48
    2005-01-11

    Table of Contents:
  • Output Caching with PHP
  • Capturing Server Side Output
  • Output Buffering for Server Side Caching
  • Multiple caching: splitting the Web page content
  • Putting it All Together

  • 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

    Dell PowerEdge Servers

    Output Caching with PHP
    (Page 1 of 5 )

    Dynamic Web pages take longer to load than static ones, which forces visitors to your site to wait -- and we all know they won't wait for very long. Output caching is a powerful technique you can use to shorten that wait and keep them from leaving.

    If we take a nostalgic look at those distant days when developing Websites consisted of writing a few, static HTML pages, made up mostly of text and scarce images, we notice that the process of sending a Web page from the Web server to a Web browser was painless and straightforward. The server had to fetch some files from the file system, and send them happily to the user’s browser, which received the parsed page almost immediately.

    Once the page was displayed, the browser would trigger its caching routines to store the finished page on the user's computer, until a new request was made for that page. With a new request for that page, the browser performed a fast check with the Web server to make sure the page hadn’t been updated, and then could display the cached, locally stored version. Ah, memories! 

    As you know, the Web became more and more complex, and new techniques had to be developed for delivering dynamic content. Most  websites migrated from static to dynamic schemas, according to current demands for satisfying content-hungry visitors. This new context rapidly broke the well-established process described above.

    Now, nearly every page requested puts into action some kind of intermediate process (or many of them) that introduces a noticeable delay when delivering Web pages to the end user. If you are within the field of PHP processing, you know that the Web server will call the PHP engine for parsing scripts, and maybe those scripts will connect to databases, and so on, all of this resulting in a lag between the user’s request for a page and the final display in the browser.

    If keeping our applications simple is not mandatory, they will become more complex, and easily cause us to run into difficulties that could increase the lag problem. There are many possible approaches to solve this situation. In this article, we will see how server side caching can help us to implement simple but powerful PHP mechanisms to avoid, or reduce, the delay between a Web server sending a dynamic page and the user seeing the finished result displayed on the machine.

    More PHP Articles
    More By Alejandro Gervasio


       · The article deals with the basics of PHP Output Caching. Also, it shows some chunked...
       · For the sake of clarity and accuracy, where it reads $cachefile, should be...
       · Too much editorialising, discussing history, something. After reading the first...
       · Hello Sr.Thank you for the comment. I'm sorry you didn't enjoy the article. That...
       · I find it interesting that you didn't mention Smarty as a caching option. On top of...
       · Hi David,Thank you for the commnent. The interspered PHP is only for the...
       · i am a beginner, just pure questions.what's the point of using all the ob_start,...
       · Yes , i like it and am using it long time ago , the benefit( my opinion) the cache...
       · Hi,I totally agree with you!Alejandro Gervasio
       · Hello, This article is intented to be an introduction to PHP cache capabilities,...
       · I disagree, the beginning of the article made the subject and benefit quite...
       · David says he'd like to see the HTML and PHP in separate files. I've been reading a...
       · Well, Smarty is an excellent template system (and includes more capabilities too)...
       · im kinda new to caching and I was trying the original script..im sorry if it looks...
       · ok im replying to myself, erm it's late here and i hate these kinda glitches that...
       · Is it possible to implement this process in the phpBB code for discussion...
       · Thank you for posting your comment here. With regard to your question, unfortunately...
       · Thanks for the very prompt reply! I guess I should just give up then....have spent...
       · I'd like thank you for posting your feedback here. With reference to your problem,...
       · Good Tutorial thk,just a little correct thoughIt would probly not be long for U...
       · Hi Sig again,Thank you fo pointing out the missing parenthesis on the code. It...
       · thnX a lot Alejandro for this amazing article.when I was read it ,I could see the...
       · Thank you for the kind comments on my PHP article and your excellent suggestion on...
     

       

    PHP ARTICLES

    - Setting Up a Web-based Image Hosting Service
    - Comparing Files and Databases with PHP Bench...
    - Setting Up a Web-Based Image Gallery
    - Using Timers to Benchmark PHP Applications
    - Benchmarking Applications with PHP
    - Setting Up a Web-Based File Manager: PHPfile...
    - Developing a Modular Class For a PHP File Up...
    - Setting Up a Web-Based File Manager: bfExplo...
    - Defining a Custom Function for File Uploader...
    - Parsing Child Nodes with the DOM XML extensi...
    - Creating an Error Handling Module for a PHP ...
    - Accessing Attributes and Cloning Nodes with ...
    - Retrieving Information on Selected Files wit...
    - Handling HTML Strings and Files with the DOM...
    - Building File Uploaders with PHP 5

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway