Greetings.

I'm using sessions with cookies on my company's website and I'm having some problem with session expiration. In some cases the session expires in a few minutes, and it's really getting hard to users to navigate "peacefully" along the site.

One thing I don't understand is why sessions expire so quickly if the "session.cache_expire" parameter is set to 180 minutes?!

I'm really confused, because there are so many parameters about timing and sessions in php.ini that it makes my head spinning
:mad:

Can someone please help me on how to extend sessions lifetime, so the users don't have to login every couple of minutes?

Should I paste the entire [session] part of my php.ini here?

Thanks (a lot) in advance,

    set to 180 minutes? or 180 seconds?

    180 minutes would be 10800 seconds

    Usually sessions time out after 24 minutes
    or, 1440 Seconds.

      I have this two parameters setted on php.ini:

      ; After this number of seconds, stored data will be seen as 'garbage' and
      ; cleaned up by the garbage collection process.
      session.gc_maxlifetime = 1440

      ; Document expires after n minutes.
      session.cache_expire = 180

      So, what you're telling me is that the "Garbage Collection" has priority over the cache expire?

      This is exactly what confuses me, I simply can't understand the difference between expiring the session cache and beginning to treat the session data as "garbage".

      Can you give me some orientation?

      Thanks in advance,

        2 months later

        I also seem to have the same problem, as my sessions only last a few minutes.

        Has there been any progress on solving this, or some candidate willing to explain?

        Thanks 🙂

          I would say that as long as the sessions don't work, don't use them. Stick to cookies.

            I'm sorry, I forgot to mention that these sessions are being used for user authentication, making cookies not really an option I would like to pursue.

            [edit] I'll also add that I have the proper session_start() on each page that is secure. [/edit]

              Another option (failing sessions) is to create a temp. area of your MySQL table which can be deleted when you logout.

              That is what I use.

              Alex.

                Write a Reply...