shane07 Posted April 2, 2008 Share Posted April 2, 2008 Hi I have problem with the cached page in my local server. Because of the cached page I cannot view the changes I had made. The server caches even the output of the php scripts. I can view the changes only when a query string is appended to the URL. Because of this my clients could not view the actual pages. I cannot say 'Append a query string to the URL'. Is there any methods in PHP to overcome this problem? Waiting for the reply. Thank you. Link to comment https://forums.phpfreaks.com/topic/99205-how-to-clear-the-server-cache-page/ Share on other sites More sharing options...
trq Posted April 2, 2008 Share Posted April 2, 2008 Your pages are likely being cached by the browser, not the server. You can set some headers that may help... <?php header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 01 Jan 2000 01:00:00 GMT"); ?> Link to comment https://forums.phpfreaks.com/topic/99205-how-to-clear-the-server-cache-page/#findComment-507589 Share on other sites More sharing options...
shane07 Posted April 2, 2008 Author Share Posted April 2, 2008 Your pages are likely being cached by the browser, not the server. You can set some headers that may help... <?php header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 01 Jan 2000 01:00:00 GMT"); ?> I think it is working now. Thank you I have also problem with css and image. The new css and image never loads unless the server skips caching. Is it also possible with PHP ? Link to comment https://forums.phpfreaks.com/topic/99205-how-to-clear-the-server-cache-page/#findComment-507603 Share on other sites More sharing options...
trq Posted April 2, 2008 Share Posted April 2, 2008 As I said, its likely your browser caching the pages. Unless the filenames change, your browser will use the local copy from its cache. Link to comment https://forums.phpfreaks.com/topic/99205-how-to-clear-the-server-cache-page/#findComment-507606 Share on other sites More sharing options...
shane07 Posted April 2, 2008 Author Share Posted April 2, 2008 Actually, it is not working. Even now the browser outputs the old page without a query string. Regarding the images and css, I tried more than I can to clear the browser-cache but never loads the new page. The browser loads the new page at around 01.00 am local time when the server do not render the cache page. Link to comment https://forums.phpfreaks.com/topic/99205-how-to-clear-the-server-cache-page/#findComment-507615 Share on other sites More sharing options...
haku Posted April 2, 2008 Share Posted April 2, 2008 control + F5 refreshes the page from the server (no cache). Link to comment https://forums.phpfreaks.com/topic/99205-how-to-clear-the-server-cache-page/#findComment-507628 Share on other sites More sharing options...
shane07 Posted April 2, 2008 Author Share Posted April 2, 2008 My site is related to an FM site which displays the current on-air program. I said 'I think it is working now' because at that time the on-air program has not been changed. After a while when the on-air program changed I tried the site again with the header information you gave but doesn't display the new page. The new page is displayed only when query string is passed. I even tried clearing the browse cache but the new page doesn't come up. An of course, I have tried control + f5 too. With the other sites, I don't have to do Ctrl+f5 or appending query strings. only with my page which doesn't use sessions. I have no problem with the pages which contain sessions. Link to comment https://forums.phpfreaks.com/topic/99205-how-to-clear-the-server-cache-page/#findComment-507629 Share on other sites More sharing options...
shane07 Posted April 5, 2008 Author Share Posted April 5, 2008 I found a new thing here. My site is showing up the new contents using the header information as described above when the url doesn't include www. eg. http://domain-name.com But using http://www.domain-name.com shows up the old content without a query string. Link to comment https://forums.phpfreaks.com/topic/99205-how-to-clear-the-server-cache-page/#findComment-510081 Share on other sites More sharing options...
pratikc Posted October 25, 2013 Share Posted October 25, 2013 Your pages are likely being cached by the browser, not the server. You can set some headers that may help... <?php header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 01 Jan 2000 01:00:00 GMT"); ?> Hi Tried using this but the cache is not getting cleared . is there any specific location in code that we need to write this ? Link to comment https://forums.phpfreaks.com/topic/99205-how-to-clear-the-server-cache-page/#findComment-1455325 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.