note 29309 added to function.session-set-save-handler
| From: | toly_sivik at hotmail dot com | Date: | Sun, 09 Feb 2003 16:35:11 +0000 |
| Subject: | note 29309 added to function.session-set-save-handler | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-43690@lists.php.net to get a copy of this message | ||
The fact that you will never need to call directly any of the functions of session_set_save_handler
is not entirely true. For some reason, the gc() function does not execute sometimes. In my case, it
didn't execute at all, thus leaving expired sessions in the database.
To make sure you don't accumulate expired sessions in your database, you can call this function
directly... for instance:
<?php
//assuming that session handler functions are saved in handler.php
// and that 1440 is the default session expire time in your php.inc file
include("handler.php");
session_start();
$max_lifetime = 1440;
gc($max_lifetime);
?>
This way you will be assure that expired sessions will get deleted from your database all the time.
--
http://www.php.net/manual/en/function.session-set-save-handler.php
http://master.php.net/manage/user-notes.php?action=edit+29309
http://master.php.net/manage/user-notes.php?action=delete+29309
http://master.php.net/manage/user-notes.php?action=reject+29309