I'm trying to set up apache mod_cache to cache dynamic pages (generated by PHP) so as to accelerate this server. Now Apache can create lots of cache files in the specified folder. The problem is that apache doesn't read from these caches to feed requests. 1. My server environment is REDHAT Enterprise 3 i686 on standard - WHM X v3.1.0 + Apache 2.2.6 + PHP 5.2.5 .
2. I've installed modules including mod_cache, mod_disk_cache, mod_mem_cache and mod_expires.
mod_cache related settings£º
CacheRoot /home/apachecache
CacheEnable disk /
CacheDirLevels 2
CacheDirLength 1
CacheDefaultExpire 86400
CacheMaxExpire 86400
3. I add the following lines in the test php page to make apache cache the result:
<?php
header("Expires: " . gmdate('D, d M Y H:i:s', time()+3600*72) ." MT" );
header("Last-Modified: ".gmdate('D, d M Y H:i:s') . ' GMT');
header("Cache-Control: public,max-age=604800");
?>
4. I also add the following lines to the test page so that I can tell whether it is read from cache:
<?php
echo date("H:i:s");
?>
After the above settings, I can see cache files are created but the page itself is always 'fresh' . Anybody here can help me? Thanks!