...

View Full Version : prevent php file from cache



extremed
06-24-2010, 09:34 PM
hi

is there way to prevent caching a php file from IE using the page?


Thanks

Keleth
06-24-2010, 09:39 PM
Is the question "Is there a way to prevent IE from using a cached php file?"?

Sorry, at least I am not exactly sure what you're asking and wanna make sure I answer it properly.

extremed
06-24-2010, 09:47 PM
Is the question "Is there a way to prevent IE from using a cached php file?"?

Sorry, at least I am not exactly sure what you're asking and wanna make sure I answer it properly.

Sorry for the language mistakes becuase im not a english man.

there is a php file [content.php] frequently updated and im loading it to a div using a java script to my main php file [index.php]

problem is IE cache content.php and it never update.

once i goto IE settings and stop caching pages it works fine. but i need a way to prevent IE from caching content.php

Keleth
06-24-2010, 10:07 PM
Well, best as I know, its not a PHP issue, but you can add


<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">


to the header of any web page you don't want cached.

You'll have to wait for someone more experienced to add a response though: I've never had the issue of php pages being cached.

Is the content of content.php static?

extremed
06-24-2010, 10:21 PM
Well, best as I know, its not a PHP issue, but you can add


<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">


to the header of any web page you don't want cached.

You'll have to wait for someone more experienced to add a response though: I've never had the issue of php pages being cached.

Is the content of content.php static?

Thanks for the reply but after adding this meta, im still having problem.

i have a shell script which run on a cronjob and update every 10 seconds and write out put into a file

content.php is read that file and output data i want

in index.php i have a javascript to load content.php every 10 seconds.


this thing works perfectly on firefox but due to cache, IE8 doesnt load updated content.php file

Keleth
06-24-2010, 10:24 PM
You have a cronjob running every 10 seconds?

Now I'm really curious what its doing, because I can't think of why you'd need a cron job to write a file every 10 seconds rather then just have the content loaded into the php file when its called...

extremed
06-24-2010, 10:31 PM
its a disk space checker, shell script output the quota usage of user.

better remove cron though :P

Keleth
06-24-2010, 10:36 PM
Well, I had best not comment as my knowledge of that topic is limited... I suspect there are better ways to do it, but hey, what do I know.

Regardless, I'd try the HTML no-cache stuff... like I said, I've never had the issue myself, so I can't help anymore, sorry. As best as I know, if there is any dynamic content in a PHP file, it'll always try to grab a new file from the server.

extremed
06-24-2010, 10:45 PM
Thanks for your help and your time. really appreciate it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum