RE: [PHP] Disable all caching

From: Date: Tue, 10 Oct 2006 16:54:31 +0000
Subject: RE: [PHP] Disable all caching
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-242910@lists.php.net to get a copy of this message
> 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); </code> Hope that helps, Brad

« previous php.general (#242910) next »