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

  • One year cookie time should like this setcookie("cookiename",'somevalue',time()+31556926 ,'/'); – Aman Alam Jun 7 '16 at 20:54

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:

  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.

  • Is it possible to go the Magento Backend and in Session Cookie Management/Cookie Lifetime set that value (10 * 365 * 24 * 60 * 60 = 315360000)? Will it work? – nano Jun 7 '16 at 21:05
  • If you don't have a problem storing it I assume yes. – Fabian Blechschmidt Jun 7 '16 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.