■ Note that caching is, in theory, a very good thing, designed to minimize unnecessary server requests. If properly controlled, caches are great for both the server and the client.
■ If you have cURL installed on your system, you can run this command to see a
page’s headers:
curl --head http://www.example.com/page.php
■ If your applications make use of sessions, you can adjust session caching with the session_cache_limit() function. See the manual for more information.
■ Page caching can also be affected using the META tags, placed within an HTML
document’s head. This may not work as reliably with some browsers as the
header() method.
■ Client/server performance can also be improved—for large scripts—using Zlib
output compression or the function ob_gzhandler() . See the PHP manual
for more on both.
Server-Side Caching
There is an alternative type of caching you can use to affect the client/server
relationship. When a PHP script is requested, the Web server asks the PHP
module to read and process that code.
Server-side caches store preprocessed versions of a script, so that they may be
served without processing. Server-side caching can greatly improve your application’s performance but normally requires more control over the server than the average user has (read: those using a shared hosting service).
If you want to look into and possibly implement server-side caching, there are
many options. APC (Alternative PHP Cache) is very popular, so much so that
it’s now part of PECL (http://pecl.php.net). It’s free, but installation can be tricky.
Zend (www.zend.com) offers the free Zend Optimizer. It’s fairly easy to install, but you must remember to upgrade it when you upgrade PHP (it’s version-specific).
For options that do not require software installation on a server, there are the PEAR Cache and Cache_Lite packages. It’s also possible to write your own caching system, although that’s probably not the most efficient idea.
- Kiran's blog
- 541 reads













Post new comment