Making a PHP Script "Very" Cache Friendly
| From: | Gerard Samuel | Date: | Mon, 02 Jun 2003 06:38:51 +0000 |
| Subject: | Making a PHP Script "Very" Cache Friendly | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-149759@lists.php.net to get a copy of this message | ||
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.
Thanks for your insight.