Hi All,

I want to set session time to all users of 10 hours. How will i set this time into php.ini file?

However php.ini having default values for all session variable.

Please suggest advice for the same.

Regards,
Jimi

    I believe session.cookie_lifetime is what you're looking for

      Hi Jack,

      First of all thanks for your reply.

      I want to give you more information about my program. I am working on one ready project which we are using right now. In that they haven't used cookies to store session for users.

      I have checked in a main page index.php in that they haven't mentioned any session variable with assign expire time.

      However i did searched on net and found php.ini file which use to define default variable for php. In that i checked three values mentioned below:

      1) session.cookie_lifetime = 0; lifetime in seconds of cookie; or if 0, until browser is restarted
      2) session.gc_maxlifetime = 1440; after this number of seconds, stored; data will be seen as 'garbage' and
      3) session.cache_expire = 180 ; document expires after n minutes

      This all values are default values. However if go with above setting in php.ini then my user session must be keep active till browser close. But its not happening at my end. Without any activity user session force to get log off automatically. I dont want that setting.

      Will change a variable "session.gc_maxlifetime" value into php.ini?

      Please let me know if you want any other info regarding same. Hope you understand what problem i am facing at my end.

      Guide me more the same. Any suggestion welcome.

      Regards,
      Jimi

        hi, its simpe

        ini_set("session.cache_expire")=600; //10 minuts

          Hi,

          session.cache_expire = 180

          it means 3 hours

          n you are saying i change it 600 minutes that means 10 hours not 10 minutes.

          Are your sure about this change? I got reply on one forum as i have to make change in my

          session.gc_maxlifetime variable with value as 36000 (10 hours).

          Please let me know if you are sure about the same.

          Regards,

            The lifetime of your session will be the lesser of session.cookie_lifetime and session.gc_maxlifetime (both are in seconds). If session.cookie_lifetime is set to 0 (the default), then that means the session cookie will not expire until the browser is closed. Read the information on this page for all of the session config settings, and how they are interrelated.

            PS: The session.cache_expire parameter has nothing to do with how long a session lasts, but rather how long (if at all) the browser is told it may cache session-controlled pages.

              Hi Nogdog,

              Thanks for your reply and clarification about session variables.

              I have changed session.gc_maxlifetime variable value and that’s work at my end.

              I will check your provided link.

              Regards,
              Jimi 🙂

                Write a Reply...