Session+cookies expiration

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daedalus.OS

    #1

    Session+cookies expiration

    Hi,
    I just started to use/learn php session and cookies. Everything looks fine,
    I took a quick look at the php session man pages but there's two little
    things that I can't figure out completely.

    1- A simple page to see what happens behind the scene:
    <?
    session_start() ;
    $_SESSION['TEST'] = "This is a test";
    phpinfo();
    ?>

    Session config looks like this:
    session.cache_e xpire = 30
    session.cookie_ lifetime = 1800
    session.gc_maxl ifetime = 1440

    phpinfo() show the following HTTP Response Headers :
    Set-Cookie: PHPSESSID=sgkdd lmuepiksd48pq1t mj38s0; expires=Sat, 21-May-2005
    10:38:41 GMT; path=/
    [Which is ok ... cookie will expire in 30 minutes (1800 seconds)]
    EXPIRES: Thu, 19 Nov 1981 08:52:00 GMT
    This is the one I don't understand, what is it, where does this value come
    from? And it's always the same exact date/time. ?!?

    2- The session files in D:\TEMP are not removed. I thought that those files
    would be removed after some time (maybe I'm just not patient enough).

    If anyone could tell more about this or point me to documentation relevant
    to one of these questions I would appreciate.

    Thanks
    Dae



  • Janwillem Borleffs

    #2
    Re: Session+cookies expiration

    Daedalus.OS wrote:[color=blue]
    > EXPIRES: Thu, 19 Nov 1981 08:52:00 GMT
    > This is the one I don't understand, what is it, where does this value
    > come from? And it's always the same exact date/time. ?!?
    >[/color]

    This field controls the caching behaviour of the browser. The value PHP
    sends by default (19th of Nov, 1981) ensures that the page will not be
    cached by the browser and will be retrieved from the server each time it's
    requested.

    More info: http://www.w3.org/Protocols/rfc2616/....html#sec14.21


    JW



    Comment

    • Daedalus.OS

      #3
      Re: Session+cookies expiration

      Thanks a lot for the rfc link ... I wasn't shure if it was related to the
      page or to cookies.

      What about the session file in the temp folder ... isn't it supposed to be
      removed automatically after a while ? And if so, is this time interval
      configurable ? I thought it was the garbage collector but maybe I'm wrong.
      Maybe it's another only-on-windows issue ... I'll try it on my freebsd box.

      Dae


      "Janwillem Borleffs" <jw@jwscripts.c om> wrote in message
      news:428fb569$0 $35662$dbd4d001 @news.euronet.n l...[color=blue]
      > Daedalus.OS wrote:[color=green]
      >> EXPIRES: Thu, 19 Nov 1981 08:52:00 GMT
      >> This is the one I don't understand, what is it, where does this value
      >> come from? And it's always the same exact date/time. ?!?
      >>[/color]
      >
      > This field controls the caching behaviour of the browser. The value PHP
      > sends by default (19th of Nov, 1981) ensures that the page will not be
      > cached by the browser and will be retrieved from the server each time it's
      > requested.
      >
      > More info: http://www.w3.org/Protocols/rfc2616/....html#sec14.21
      >
      >
      > JW
      >
      >
      >[/color]


      Comment

      • Janwillem Borleffs

        #4
        Re: Session+cookies expiration

        Daedalus.OS wrote:[color=blue]
        > What about the session file in the temp folder ... isn't it supposed
        > to be removed automatically after a while ? And if so, is this time
        > interval configurable ? I thought it was the garbage collector but
        > maybe I'm wrong. Maybe it's another only-on-windows issue ... I'll
        > try it on my freebsd box.[/color]

        It's very common that session files aren't cleaned up by PHP. Personally I
        use a cronjob to take care of this once a week.


        JW



        Comment

        • R. Rajesh Jeba Anbiah

          #5
          Re: Session+cookies expiration

          Janwillem Borleffs wrote:
          <snip>
          [color=blue]
          > It's very common that session files aren't cleaned up by PHP.[/color]
          Personally I[color=blue]
          > use a cronjob to take care of this once a week.[/color]


          Mostly it has to do with your gc setting
          <http://in.php.net/session#ini.ses sion.gc-divisor> Since, you'll be the
          only person who make requests, it will be hard for the gc to be called.

          --
          <?php echo 'Just another PHP saint'; ?>
          Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

          Comment

          • Daedalus.OS

            #6
            Re: Session+cookies expiration

            Thanks a lot guys ...

            Dae


            "R. Rajesh Jeba Anbiah" <ng4rrjanbiah@r ediffmail.com> wrote in message
            news:1116815794 .662210.139190@ g43g2000cwa.goo glegroups.com.. .[color=blue]
            > Janwillem Borleffs wrote:
            > <snip>
            >[color=green]
            >> It's very common that session files aren't cleaned up by PHP.[/color]
            > Personally I[color=green]
            >> use a cronjob to take care of this once a week.[/color]
            >
            >
            > Mostly it has to do with your gc setting
            > <http://in.php.net/session#ini.ses sion.gc-divisor> Since, you'll be the
            > only person who make requests, it will be hard for the gc to be called.
            >
            > --
            > <?php echo 'Just another PHP saint'; ?>
            > Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/
            >[/color]


            Comment

            Working...