So I did some tests on changing the location of the session files.
I made a first test with a subdirectory of the usual session directory: /tmp/mysession
I did set the timeout to 1 hour, but the directory /tmp/mysession has been deleted after 20 minutes.
Then I did a second test by moving the directory to my home directory: /home/mydir/sessions
the session did last 1 hour, but the files are not deleted. However, since this is a site with not many hits, that does not bother me, I can delete them sometimes.
The code I used:
function startCMSSession(){
global $site_sessionname;
// $sessdir = ini_get('session.save_path') . DIRECTORY_SEPARATOR . $site_sessionname;
$sessdir = "/home/revesman/sessions";
// need to create the directory ?
if (!is_dir($sessdir)) {
mkdir($sessdir, 0777);
}
ini_set('session.save_path', $sessdir);
$timeout = 86400; // 86400 sec = 24 hours
session_set_cookie_params($timeout, "/");
ini_set('session.gc_maxlifetime', $timeout + 600); // security of 10 minutes
session_name($site_sessionname);
session_start();
}
Tristan