17-12-2009

PHP configuration Control session length

Use the following to set the necessary ini values that allow you to control time before php sessions are garbage collected

$timeout = 7200; // 2hours
ini_set('session.gc_maxlifetime', $timeout);
 
$dir = ini_get('session.save_path').DIRECTORY_SEPARATOR.'mysite';
if (!is_dir($dir)) { mkdir($dir, 0777); }
ini_set('session.save_path', $dir);
 

Source:http://akrabat.com/site/three-years-of-my-zend-framework-tutorial/

session.gc_maxlifetime specifies the number of seconds after which data will be seen as 'garbage' and potentially cleaned up. Garbage collection may occur during session start (depending on session.gc_probability and session.gc_divisor).

session.save_path defines the argument which is passed to the save handler. If you choose the default files handler, this is the path where the files are created. See also session_save_path().

Comments:

Your comment:

»

 

[x]