Magento – Session cookie timeout limit

cookiemagento-1.9sessiontimeout

Is there a maximum timeout that we can set for the session cookie?
Can I set it up to 1 year for example?

Best Answer

As written on stackoverflow by Joeri Hendrickx

All cookies expire as per the cookie specification, so this is not a PHP limitation.

Use a far future date. For example, set a cookie that expires in ten years:

setcookie(
  "CookieName",
  "CookieValue",
  time() + (10 * 365 * 24 * 60 * 60)
);

Note that if you set a date past 2038 in PHP, the number will wrap around and you'll get a cookie that expires instantly.

Related Topic