1

I have a small Xampp server that I use for coding and prototyping of php sites. Every time I refresh a page I typically have made adjustments to the code of the page in the last few seconds. There is no reason for any of the content that comes from the server to be cached, and I am having problems with my work that it is caching content.

Is there an easy way in apache or php to make the default for all content served, uncached? The only thing that can see the server is my workstation since my firewall is configured to prevent outside communication, so no worries there.

I would prefer a setting in apache or php.in instead of a browser based solution. Thoughts?

2 Answers 2

1

If you are using firefox, ctl-R will reload the page, and not use the cached copy... Otherwise, you can set a header using php's header() function that tells when the page will be out of date. You can set it for 5 seconds in the future when the page is generated, and that should help.

Edit:

You can go here and search for "Expire" to learn more about the expire header: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

3
  • Note that ZAK used a capital 'R', it must be caps for a real refresh I think. Nov 19, 2009 at 20:13
  • Yeah, I was hoping for something in the apache config or php.ini. Thanks though, in the future I will use the ctl-R
    – Tvanover
    Nov 19, 2009 at 20:16
  • I was sure that ctrl-F5 or holding ctrl while hitting the reload button works too. Might want to test that theory, though.
    – Kzqai
    May 13, 2010 at 20:53
1

On the server side you can enable no-cache... stuff in the HTTP headers.

See:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .