RE: [PHP] Making a PHP Script "Very" Cache Friendly

From: Date: Mon, 02 Jun 2003 07:46:02 +0000
Subject: RE: [PHP] Making a PHP Script "Very" Cache Friendly
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-149764@lists.php.net to get a copy of this message
On 02-Jun-2003 Gerard Samuel wrote: > Searching through the archives, most people are running away from > caching php scripts. > Im trying to do the opposite. > I have a script that fetches css files. Im trying to add header() calls > to it so > that browsers can cache it like a normal css file. > This is what I have at the top of the file -> > ---------- > header('Content-type: text/css'); > header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 3600) . ' > GMT'); > header('Last-Modified: ' . gmdate('D, d M Y H:i:s', > filemtime('./foo.php')) . ' GMT'); > -------- > > For the life of me, according to the output of ethereal (a network > sniffer), this file is always fetched from the server. > Yes I did breeze by the HTTP 1.1 spec, but I didn't pick up on anything > special that I should be doing. > > Is there a way to make the file be put into cache, or am I barking up > the wrong tree. > Try adding one more 'hint': header('Cache-Control: max-age=3600'); Regards, -- Don Read dread@texas.net -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it.

« previous php.general (#149764) next »