How can I make a php session to never expire (in the conf file, no code)

后端 未结 1 1667
青春惊慌失措
青春惊慌失措 2020-12-19 20:49

I would like to manage the time that a session expire to be forever.

What do I have to change In the php configuration file so this change is permanent and I don\'t

相关标签:
1条回答
  • 2020-12-19 21:14

    It is not possible to store the session infinitely unless you do not use garbage collection in php. You could try to set the php ini settings and set the time to 10 years

    // set the max life time, after this, session is seen as garbage
    session.gc_maxlifetime=315360000
    

    If you have cookies enabled:

    session.use_cookies=1
    #session.use_only_cookies=1
    
    // set the cookie expiration as well
    session.cookie_lifetime=315360000
    

    To avoid Int overflow, do not use a value larger than 2,147,483,647 as this is the max an Int32 can hold.

    0 讨论(0)
提交回复
热议问题