Magento front-end session timing out too soon

Problem

The Magento site is timing out soon while Cookie Lifetime in Magento configuration set to default 3600 seconds.

Cause

PHP’s session.gc_maxlifetime was set to be a small number so PHP cleared the session data before Magento had the chance to access it.

Solution

Set session.gc_maxlifetime in the site's php.ini to a number larger than the Cookie Lifetime.

To check Cookie Lifetime in Magento:

  1. Log in to Magento Admin Panel
  2. Navigate to System → Configuration → Web → GENERAL
  3. Look under Session Cookie Management for Cookie Lifetime
  4. Make sure it is set as intended (in seconds).