Re: Disable all caching

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, October 10, 2006 10:17 am, Benjamin Adams wrote:
> 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?

All the headers and all the META tags in the world won't get EVERY
browser and EVERY caching / proxy server (AOHell) to stop caching.

If you really truly absolutely MUST have no caching at all, generate
random/unique URLs for your content.

<img src="/images/phpscript/nocache=<?php echo
mt_rand()?>/whatever.jpg" />

phpscript can be ForceType'd to readfile whatever.jpg (or to
fopen/fread/echo if your JPGs are large) and the nocache will
guarantee the browser won't cache it.

More precisely, the browser WILL cache it, but you send the browser a
new URL every time, so it renders the cached item useless.

Maybe if the browser-makers actually honored the no-cache headers they
keep making up out of thin air, I would feel bad about wasting their
cache like this.  But they don't, so I don't.

You need the .jpg at the end for IE to do the right thing.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux