Reputation: 4944
When I look at the cookies for my site in Google Chrome, I see PHPSESSID
,__utma
, __utmb
, __utmc
, and __utmz
. I don't understand what these cookies mean, except for maybe PHPSESSID
, which I assume is the user's login session. Some expire "When I close my browser" and other expire at some future date. Is there a way I could make them all expire in 2 years for example?
I'm trying to make it so the user stays logged in after closing the browser.
Upvotes: 0
Views: 11524
Reputation: 270707
__utma, __utmb, __utmc, __utmz
are cookies set by Google Analytics, not your site's code.
To extend the PHPSESSID
cookie, your PHP session cookie, modify the setting in php.ini:
; some long value in seconds (1 year)
session.gc_maxlifetime = 31536000
session.cookie_lifetime = 31536000
For cookies you yourself have set in code via setcookie()
(none of which are listed among your list), pass the third parameter as a value in seconds:
// Two year cookie (86400 secs per day for 2 years)
setcookie('name', 'cookievalue', time() + 86400 * 365 * 2);
Upvotes: 4
Reputation: 7026
you need to find the code that sets the coockies and add the appropriate expire time
setcookie ("TestCookie", "", time() + 3600); //expires after 1 hour
Upvotes: 1