questions about sessions

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

    questions about sessions

    Hi All,

    First, just wanted to say that I found what I thought was a very helpful
    tutorial on sessions in case anyone out there has questions on them:



    I've been using sessions for quite some time but only after reading this
    do I really understand what is going on on both the client and server side.

    Unfortunately, I still have some unanswered questions after reading it,
    as it is pretty basic and gives a quick intro to sessions. For testing
    purposes, I turned off all cookies in IE and attempted to sign into my
    site on my local host, which uses sessions for signing in. In addition,
    session.use_tra ns_sid = 0 in my ini file. I can't figure out how, but
    somehow my scripts all still work and I am able to login fine, even
    though cookies are disabled, as well as trans sid. How is my session id
    being passed, as my understanding is these are the 2 possible methods?
    There is no sessid propagated through the URL either, so it is not
    through a get variable.

    Also, I looked in my sessiondata folder and found a bunch of session
    data. When I physically log out and kill a session, it removes it from
    the folder. However, when I just close the browser window, it does not
    remove the data from the folder. Reopening the browser right away
    results in a new session and requires the user to login again, but the
    old data from the previous session is still there. I checked my ini,
    and found the default:

    ; 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

    But this isn't working as far as I can tell because I have session files
    from days ago, and according to this it should be deleted after 24 minutes.

    Sorry for the long post, but thanks in advance for all help!!

    Marcus

  • Ian.H

    #2
    Re: questions about sessions

    On Tue, 03 Aug 2004 17:17:35 +0000, Marcus wrote:
    [color=blue]
    > ; 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
    >
    > But this isn't working as far as I can tell because I have session files
    > from days ago, and according to this it should be deleted after 24 minutes.[/color]


    Isn't that 1440 seconds? Inwhich case, that's 24 hours, not mins =)



    Regards,

    Ian

    --
    Ian.H
    digiServ Network
    London, UK


    Comment

    • Ian.H

      #3
      Re: questions about sessions

      On Tue, 03 Aug 2004 20:02:14 +0000, Ian.H wrote:
      [color=blue]
      > On Tue, 03 Aug 2004 17:17:35 +0000, Marcus wrote:
      >[color=green]
      >> ; 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
      >>
      >> But this isn't working as far as I can tell because I have session files
      >> from days ago, and according to this it should be deleted after 24 minutes.[/color]
      >
      >
      > Isn't that 1440 seconds? Inwhich case, that's 24 hours, not mins =)[/color]


      Sorry, ignore my reply above.. [ makes mental note to engage brain
      _before_ fingers ] it's been a long day =)



      Regards,

      Ian

      --
      Ian.H
      digiServ Network
      London, UK


      Comment

      • Geoff Berrow

        #4
        Re: questions about sessions

        I noticed that Message-ID:
        <pan.2004.08.03 .20.05.59.95400 0@bubbleboy.dig iserv.net> from Ian.H
        contained the following:
        [color=blue][color=green]
        >> Isn't that 1440 seconds? Inwhich case, that's 24 hours, not mins =)[/color]
        >
        >
        >Sorry, ignore my reply above.. [ makes mental note to engage brain
        >_before_ fingers ] it's been a long day =)[/color]

        I have to teach basic skills numeracy in September if you are
        interested...<g >

        --
        Geoff Berrow (put thecat out to email)
        It's only Usenet, no one dies.
        My opinions, not the committee's, mine.
        Simple RFDs http://www.ckdog.co.uk/rfdmaker/

        Comment

        • Chung Leong

          #5
          Re: questions about sessions

          "Marcus" <JumpMan222@aol .com> wrote in message
          news:PMPPc.2588 $hI.854722@news svr28.news.prod igy.com...[color=blue]
          > ; 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
          >
          > But this isn't working as far as I can tell because I have session files
          > from days ago, and according to this it should be deleted after 24[/color]
          minutes.

          I'm been just waiting for someone to ask that one :-)

          The reason why the files are still there is because PHP does not garbage
          collect on every request session expiration does not happen very often. It
          does it only once in a while. The chance of garbage collection being trigger
          on a given request equals session.gc_prob ability / session.gc_divi sor. If
          your set both to 100, then GC happens on every request.


          --
          Obey the Clown - http://www.conradish.net/bobo/


          Comment

          • Ian.H

            #6
            Re: questions about sessions

            On Tue, 03 Aug 2004 21:28:35 +0100, Geoff Berrow wrote:
            [color=blue]
            > I noticed that Message-ID:
            > <pan.2004.08.03 .20.05.59.95400 0@bubbleboy.dig iserv.net> from Ian.H
            > contained the following:
            >[color=green][color=darkred]
            >>> Isn't that 1440 seconds? Inwhich case, that's 24 hours, not mins =)[/color]
            >>
            >>
            >>Sorry, ignore my reply above.. [ makes mental note to engage brain
            >>_before_ fingers ] it's been a long day =)[/color]
            >
            > I have to teach basic skills numeracy in September if you are
            > interested...<g >[/color]


            Sign me up for 2 classes Geoff! lol

            Just finished my 13 hour day.. and what an eventful evening =)



            Regards,

            Ian

            --
            Ian.H
            digiServ Network
            London, UK


            Comment

            • Marcus

              #7
              Re: questions about sessions

              Chung Leong wrote:[color=blue]
              > "Marcus" <JumpMan222@aol .com> wrote in message
              > news:PMPPc.2588 $hI.854722@news svr28.news.prod igy.com...
              >[color=green]
              >>; After this number of seconds, stored data will be seen as 'garbage' and
              >>; cleaned up by the garbage collection process.
              >>session.gc_ma xlifetime = 1440
              >>
              >>But this isn't working as far as I can tell because I have session files
              >>from days ago, and according to this it should be deleted after 24[/color]
              >
              > minutes.
              >
              > I'm been just waiting for someone to ask that one :-)
              >
              > The reason why the files are still there is because PHP does not garbage
              > collect on every request session expiration does not happen very often. It
              > does it only once in a while. The chance of garbage collection being trigger
              > on a given request equals session.gc_prob ability / session.gc_divi sor. If
              > your set both to 100, then GC happens on every request.
              >
              >[/color]

              I believe the default for that is 1, which I assumed to mean 100% - all
              that math and stats getting my CS degree trained me to think 1 is 100%
              :-) Thanks for clearing that up, I will try it out.

              Anyone have any ideas on the first part of my question with how the
              session even is working with cookies off and trans_sid off? Thanks as
              always.

              Marcus

              Comment

              • Marcus

                #8
                Re: questions about sessions

                Marcus wrote:
                [color=blue]
                > I believe the default for that is 1, which I assumed to mean 100% - all
                > that math and stats getting my CS degree trained me to think 1 is 100%
                > :-) Thanks for clearing that up, I will try it out.
                >
                > Anyone have any ideas on the first part of my question with how the
                > session even is working with cookies off and trans_sid off? Thanks as
                > always.
                >
                > Marcus
                >[/color]

                Chung,

                Continuing your last post, sorry but I forgot to ask, is there an
                optimal value to set it to? i.e. does garbage collecting 100% of the
                time have detrimental effects like slower performance? If not, I can't
                see why it wouldn't be defaulted to 100%...

                Marcus

                Comment

                • R. Rajesh Jeba Anbiah

                  #9
                  Re: questions about sessions

                  Marcus <JumpMan222@aol .com> wrote in message news:<PMPPc.258 8$hI.854722@new ssvr28.news.pro digy.com>...
                  <snip>[color=blue]
                  > For testing
                  > purposes, I turned off all cookies in IE and attempted to sign into my
                  > site on my local host, which uses sessions for signing in. In addition,
                  > session.use_tra ns_sid = 0 in my ini file. I can't figure out how, but
                  > somehow my scripts all still work and I am able to login fine, even
                  > though cookies are disabled, as well as trans sid.[/color]
                  <snip>

                  Not at all possible. I guess 2 reasons:
                  1. You didn't _actually_ disable cookies
                  2. Your login script is buggy

                  --
                  | Just another PHP saint |
                  Email: rrjanbiah-at-Y!com

                  Comment

                  • John Wellesz

                    #10
                    Re: questions about sessions

                    On 04 août 2004, Sir ng4rrjanbiah@re diffmail.com (R. Rajesh Jeba Anbiah)
                    claimed in news:abc4d8b8.0 408032137.cfe79 c3@posting.goog le.com:
                    [color=blue]
                    > Marcus <JumpMan222@aol .com> wrote in message
                    > news:<PMPPc.258 8$hI.854722@new ssvr28.news.pro digy.com>...
                    > <snip>[color=green]
                    >> For testing
                    >> purposes, I turned off all cookies in IE and attempted to sign into
                    >> my site on my local host, which uses sessions for signing in. In
                    >> addition, session.use_tra ns_sid = 0 in my ini file. I can't figure
                    >> out how, but somehow my scripts all still work and I am able to login
                    >> fine, even though cookies are disabled, as well as trans sid.[/color]
                    > <snip>
                    >
                    > Not at all possible. I guess 2 reasons:
                    > 1. You didn't _actually_ disable cookies
                    > 2. Your login script is buggy
                    >[/color]


                    Just create a script that call phpinfo() and watch in the variable part if
                    IE send cookies.

                    Comment

                    • Chung Leong

                      #11
                      Re: questions about sessions

                      "Marcus" <JumpMan222@aol .com> wrote in message
                      news:UjZPc.81$r _1.33142@newssv r28.news.prodig y.com...[color=blue]
                      > Marcus wrote:
                      >[color=green]
                      > > I believe the default for that is 1, which I assumed to mean 100% - all
                      > > that math and stats getting my CS degree trained me to think 1 is 100%
                      > > :-) Thanks for clearing that up, I will try it out.
                      > >
                      > > Anyone have any ideas on the first part of my question with how the
                      > > session even is working with cookies off and trans_sid off? Thanks as
                      > > always.
                      > >
                      > > Marcus
                      > >[/color]
                      >
                      > Chung,
                      >
                      > Continuing your last post, sorry but I forgot to ask, is there an
                      > optimal value to set it to? i.e. does garbage collecting 100% of the
                      > time have detrimental effects like slower performance? If not, I can't
                      > see why it wouldn't be defaulted to 100%...[/color]

                      It slows things down a bit, but probably not by much. Then again, there's no
                      harm in keeping the expired session files around either. A few 100-byte
                      files won't kill your disk quota. And if you have hundreds of concurrent
                      sessions, that probably means you're getting thousands of page hits, so the
                      GC mechanism would be triggered often enough at the default setting.


                      --
                      Obey the Clown - http://www.conradish.net/bobo/


                      Comment

                      Working...