Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Jun 2010
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    prevent php file from cache

    hi

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


    Thanks

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,535
    Thanks
    45
    Thanked 259 Times in 256 Posts
    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.

  • #3
    New Coder
    Join Date
    Jun 2010
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Keleth View Post
    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

  • #4
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,535
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Well, best as I know, its not a PHP issue, but you can add

    Code:
    <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?

  • #5
    New Coder
    Join Date
    Jun 2010
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Keleth View Post
    Well, best as I know, its not a PHP issue, but you can add

    Code:
    <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
    Last edited by extremed; 06-24-2010 at 09:25 PM.

  • #6
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,535
    Thanks
    45
    Thanked 259 Times in 256 Posts
    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...

  • #7
    New Coder
    Join Date
    Jun 2010
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts
    its a disk space checker, shell script output the quota usage of user.

    better remove cron though :P

  • #8
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,535
    Thanks
    45
    Thanked 259 Times in 256 Posts
    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.

  • #9
    New Coder
    Join Date
    Jun 2010
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for your help and your time. really appreciate it.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •