Page 1 of 1

header no-cache failing

Posted: Mon Jul 31, 2006 5:42 am
by larrymoe
Hi All ... my first post here ...

I seem to be the only guy that can't stop my PHP files caching ... so I thought someone might help me out ...

My Flash Movie submits a sendAndLoad to my php file ... the file collects data from a mysql database ... and the results are sent back to flash using the echo command in php. This all works fine right now.

When i put the PHP headers in to try and stop the php file caching the results are no longer being received.

The headers i am using are below:

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-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0

When i edit the cahced file in my Temporary Internet Files folder i find it is the results from my mysql searches i am echoing back to be used in flash.

Any ideas anyone?

Thanks

Posted: Mon Jul 31, 2006 5:56 am
by anjanesh
How abt

Code: Select all

header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0');
?

Posted: Mon Jul 31, 2006 6:13 am
by larrymoe
Thanks for the quick reply ... but my php results still appear in the cache ... is it possible it's a php.ini setting?

Posted: Mon Jul 31, 2006 8:17 am
by anjanesh
larrymoe wrote:Thanks for the quick reply ... but my php results still appear in the cache ... is it possible it's a php.ini setting?
Thats strange. So far, that one header line has not cached anything on my page(s).

Posted: Mon Jul 31, 2006 8:20 am
by feyd
The browser will cache pages as it chooses, the headers simply request that it doesn't. Generally, a small amount of caching will always be done, but a well behaved browser will still honor the request to fetch the page again by considering it expired.

Posted: Mon Jul 31, 2006 8:24 am
by larrymoe
Thanks All ... appreciated the help.

What I have found is that if I run the PHP file independently then it will not cache ... but when I run it as a sendAndLoad command from my flash movie it caches every time ... not sure I'll be able to get help on this.