Score:1

What is the maximum value you can set the cookie_lifetime to?

pg flag

I have a Drupal 8 site, and in my sites/default/servicel.yml file, I need to set the cookie lifetime to their maximum allowed value. I have searched the internet, but I can't seem to find the maximum allowed value. Is there one? Currently it is set to:

# Set session lifetime (in seconds), i.e. the time from the user's last
# visit to the active session may be deleted by the session garbage
# collector. When a session is deleted, authenticated users are logged out,
# and the contents of the user's $_SESSION variable is discarded.
# @default 200000
gc_maxlifetime: 2147483647
#
# Set session cookie lifetime (in seconds), i.e. the time from the session
# is created to the cookie expires, i.e. when the browser is expected to
# discard the cookie. The value 0 means "until the browser is closed".
# @default 2000000
cookie_lifetime: 2147483647
sonfd avatar
in flag
Is that not long enough? > 68 years?
4uk4 avatar
cn flag
PHP 32-bit or 64-bit? For 32-bit this is the maximum positive value and adding the current time results in an overflow. This is why you can't go beyond 2038 (the Y2K38 bug). For 64-bit there is no restriction as long as the browser accepts the expires date.
pg flag
@sonfd - haha, yeah, but I'm not sure it's being accepted - I think the vlue may be too high ! Ps. I didn't set this value !
cn flag
I think you need to step back here, What Drupal website do you see being used that long? Further, what browser would never have it's storage cleared for that long? This value (personally) should be set to something within the realm of minutes to months. You have to explain that browsers/os are upgraded, and cookies will be lost. A user should be logging in from time to time for security reasons.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.