I read I should increase gc_maxlifetime
in php.ini
to the same large value (weeks) as the one I'm telling Zend_Session::rememberMe()
. Is this good practice? Is there a reason not to increase gc_maxlifetime
to more than half an hour or so?
Asked
Active
Viewed 665 times
2
-
As a side note: if you are trying to achieve a "remember me" function that keeps users logged in, you can't do it with sessions, because for the users that do not want that, each time the browser opens you will start a new session. If you increase this value to 'weeks' you will have dead session files kept for long time. – venimus Jun 15 '11 at 11:51
-
@venimus so what would be the good way of doing this? – cambraca Jun 16 '11 at 18:35
-
just store a cookie and reinitialize automatically the login routine when the cookie is set but there is no session. – venimus Jun 17 '11 at 10:14
-
@SMka I want to see for a few more days if there are any new ideas.. – cambraca Jun 20 '11 at 16:29
1 Answers
0
it is good practice. if you have many (thousands) site users - you can code custom session handler. for example, to support different directory structure.
like /sessiondir/0/1/5/0152837462938587.sess
to minimize server load while reading dir with many files

SMka
- 3,021
- 18
- 14
-
gc_maxlifetime tells garbage collector how long to keep session files. If you set rememberMe() to 1 week it will simply set your cookie to that expiration time, but gc have no clue about that and removes sessions according to gc_maxlifetime. Basically you may end up with missing sessions after gc_maxlifetime passes – venimus Jun 15 '11 at 12:01
-
thanks for your answer. Do you know how to do custom session handling in Zend Framework? – cambraca Jun 16 '11 at 18:37
-
@cambraca: it is not Zend action. http://ru2.php.net/manual/en/function.session-set-save-handler.php – SMka Jun 17 '11 at 06:43