Caching output in PHP

Caching output in PHP

Caching output in PHP

Caching of output in PHP is made easier by the use of the output buffering functions built in to PHP 4 and above.

You’ll need to use two files to set up a caching system for your site. The first, “begin_caching.php” in this case, will run before any other PHP on your site. The second, “end_caching.php” in this case, runs after normal scripts have run. The two scripts effectively wrap around your current site.

This is done by adding the following two lines of code to your htaccess file.

1. php_value auto_prepend_file /full/path/begin_caching.php
2. php_value auto_append_file /full/path/end_caching.php

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.