PHP pages cache when I don't want them to - help!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phil Powell

    PHP pages cache when I don't want them to - help!

    // PREVENT CACHING FIRST BEFORE ANYTHING ELSE!
    header("Expires : Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always
    modified
    header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache"); // HTTP/1.0

    I am using the following commands to force the PHP script to not cache;
    however, it still does cache. Browser settings were checked and corrected;
    yet it still caches.

    Suggestions?

    Phil


  • Nikolai Chuvakhin

    #2
    Re: PHP pages cache when I don't want them to - help!

    "Phil Powell" <soazine@erols. com> wrote in message
    news:<laGWa.359 7$cf.2209@laker ead04>...[color=blue]
    >
    > header("Expires : Mon, 26 Jul 1997 05:00:00 GMT");
    > header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    > header("Cache-Control: no-store, no-cache, must-revalidate");
    > header("Cache-Control: post-check=0, pre-check=0", false);
    > header("Pragma: no-cache");
    >
    > I am using the following commands to force the PHP script to not cache;
    > however, it still does cache. Browser settings were checked and corrected;
    > yet it still caches.[/color]

    Check if the script outputs anything (including whitespace) before
    those header() calls. In particular, verify that the first five
    characters in your script file are '<?php'. If this is not the case,
    header() calls will be ignored.

    Cheers,
    NC

    Comment

    Working...