> -----Original Message-----
> From: Brad Fuller [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 10, 2006 12:55 PM
> To: php-general@lists.php.net
> Subject: RE: [PHP] Disable all caching
> 
> > I have a php (ver 4.x) script that is being cached.
> > I have placed:
> > <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
> > but the page is still being cached.  I'm not sure if its apache or
the
> > php.  How can I disable all caching?
> > is there something I can set in php.ini?
> >
> > (Mac OS X Server)
> >
> > Thanks
> >
> > Ben
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> Try adding this to your php page
> 
> <code>
> 
> if(!strpos(strtolower($_SERVER[HTTP_USER_AGENT]), "msie") === FALSE) {
>    header("HTTP/1.x 205 OK");
> } else {
>    header("HTTP/1.x 200 OK");
> }
> header("Pragma: no-cache");
> 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-cache, cachehack=".time());
> header("Cache-Control: no-store, must-revalidate");
> header("Cache-Control: post-check=-1, pre-check=-1", false);


I've seen a lot of people do this, so I have to comment.  The last
Cache-Control header REPLACES any other Cache-Control headers set
previously unless you specify not to.

http://us2.php.net/manual/en/function.header.php

The header 

Cache-Control: no-cache, cachehack=time()

will never be sent because the second one replaces it.  The third one
uses the second argument to specify that it should not replace the
existing one.  Of those three Cache-Control lines, only two will even be
sent to the browser.

Cache-Control: no-store, must-revalidate
Cache-Control: post-check=-1, pre-check=-1


kgt

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to