By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,304 Members | 1,254 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,304 IT Pros & Developers. It's quick & easy.

PHP pages cache when I don't want them to - help!

P: n/a
// PREVENT CACHING FIRST BEFORE ANYTHING ELSE!
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always
modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0

I am using the following commands to force the PHP script to not cache;
however, it still does cache. Browser settings were checked and corrected;
yet it still caches.

Suggestions?

Phil
Jul 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Phil Powell" <so*****@erols.com> wrote in message
news:<laGWa.3597$cf.2209@lakeread04>...

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

I am using the following commands to force the PHP script to not cache;
however, it still does cache. Browser settings were checked and corrected;
yet it still caches.


Check if the script outputs anything (including whitespace) before
those header() calls. In particular, verify that the first five
characters in your script file are '<?php'. If this is not the case,
header() calls will be ignored.

Cheers,
NC
Jul 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.