Jump to content

how to clear the server-cache page


shane07

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

  • 5 years later...

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.