session.gc_maxlifetime

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jarret.austin@gmail.com

    session.gc_maxlifetime

    Hi all

    I'm trying to set my sessions to be deleted after 60 seconds of
    inactivity (for testing), however they seem to be deleted after 60
    seconds regardless of activity.

    I have the following in my php.ini file:

    session.gc_maxl ifetime = 60
    session.gc_prob ability = 100

    I have a login check script on every page that prints the current time
    to the session, however my session is *always* deleted after 60
    seconds, not after 60 inactive seconds.

    It is my understanding that session.gc_maxl ifetime is the number of
    seconds an inactive session is allowed to live...is this correct?

    If so why does my session get deleted after 60 seconds even though it's
    active?

    Thanks for any help!

    JA

  • News Me

    #2
    Re: session.gc_maxl ifetime

    jarret.austin@g mail.com wrote:[color=blue]
    > Hi all
    >
    > I'm trying to set my sessions to be deleted after 60 seconds of
    > inactivity (for testing), however they seem to be deleted after 60
    > seconds regardless of activity.
    >
    > I have the following in my php.ini file:
    >
    > session.gc_maxl ifetime = 60
    > session.gc_prob ability = 100
    >
    > I have a login check script on every page that prints the current time
    > to the session, however my session is *always* deleted after 60
    > seconds, not after 60 inactive seconds.
    >
    > It is my understanding that session.gc_maxl ifetime is the number of
    > seconds an inactive session is allowed to live...is this correct?[/color]

    Nope! From my PHP 5 php.ini:
    -----
    ; After this number of seconds, stored data will be seen as 'garbage' and
    ; cleaned up by the garbage collection process.
    session.gc_maxl ifetime = 1440
    -----
    It appears to have nothing to do with (in)activity.

    NM

    --
    convert UPPERCASE NUMBER to a numeral to reply

    Comment

    • jarret.austin@gmail.com

      #3
      Re: session.gc_maxl ifetime

      Thanks. I thought this was the case but I've seen different
      explanations online. That being said, is there a way in php.ini to
      have a session timeout after "x" seconds of *in*-activity?

      JA

      Comment

      • Mark

        #4
        Re: session.gc_maxl ifetime

        jarret.austin@g mail.com wrote:
        [color=blue]
        > Thanks. I thought this was the case but I've seen different
        > explanations online. That being said, is there a way in php.ini to
        > have a session timeout after "x" seconds of *in*-activity?
        >
        > JA[/color]

        nope.

        best thing you could do would be to look at each request for a given
        session, and see when the last request was (you would have to save a 'last
        request time' for each session). if it was more than sixty seconds prior,
        you could manually nuke the session yourself.

        mark.


        --
        I am not an ANGRY man. Remove the rage from my email to reply.

        Comment

        • Chung Leong

          #5
          Re: session.gc_maxl ifetime

          <jarret.austin@ gmail.com> wrote in message
          news:1108084828 .484105.220670@ f14g2000cwb.goo glegroups.com.. .[color=blue]
          > Thanks. I thought this was the case but I've seen different
          > explanations online. That being said, is there a way in php.ini to
          > have a session timeout after "x" seconds of *in*-activity?
          >
          > JA
          >[/color]

          Dude, these guys are totally pulling your legs. Session file garbage
          collection is based on the last-modified-time of the session file. The
          last-modified-time is updated whenever the session is accessed (regardless
          of whether the session variables have changed or not). The catch is that the
          session cannot be completely empty.


          Comment

          • jarret.austin@gmail.com

            #6
            Re: session.gc_maxl ifetime

            If that's true (and I hope it is) why does my session get deleted after
            60 seconds even though the last-modified-time changes?

            JA

            Comment

            • R. Rajesh Jeba Anbiah

              #7
              Re: session.gc_maxl ifetime

              jarret.austin@g mail.com wrote:[color=blue]
              > If that's true (and I hope it is) why does my session get deleted[/color]
              after[color=blue]
              > 60 seconds even though the last-modified-time changes?[/color]

              There *was* some issues under Windows (FAT), but that was sorted out
              <http://in2.php.net/session#ini.ses sion.gc-maxlifetime> Perhaps you
              should be more specific about your OS, PHP versions, etc?

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

              Comment

              • chernyshevsky@hotmail.com

                #8
                Re: session.gc_maxl ifetime

                Source codes don't lie:

                // mod_files.c, line 219

                if (VCWD_STAT(buf, &sbuf) == 0 &&
                (now - sbuf.st_mtime) > maxlifetime) {
                VCWD_UNLINK(buf );
                nrdels++;
                }

                Comment

                Working...