I have a site that creates a Session for shopping carts.
$_SESSION[\'cart\']=array();
It seems as if the server automatically kills the ses
Call session_set_cookie_params() before you call session_start() in your scripts:
$session_lifetime = 3600 * 24 * 2; // 2 days
session_set_cookie_params ($session_lifetime);
session_start();
// ...
From the documentation:
session_set_cookie_params()
Set cookie parameters defined in the php.ini file. The effect of this function only lasts for the duration of the script. Thus, you need to callsession_set_cookie_params()for every request and beforesession_start()is called.
Alternatively, you could update your php.ini file's session.cookie_lifetime directive to 2 days (in seconds).