hi...... I want session destroy automatically after 30 minutes. how can set the time limit in session.. plz help me...............
<?php ini_set('session.cache_expire',30); session_start(); ?> PHP: Or you could just set a cookie expiration time for 30 minutes.
PHP starts a session garbage collection cycle at random intervals. During this cycle, any session that has not been used in the past session.gc_maxlifetime seconds is considered stale and deleted. Set it to the number of seconds you want the session to live. This can be done in php.ini file or inside your script like this: ini_set("session.gc_maxlifetime", 30 * 60); session_start(); PHP: Default value seems to be 1440 (24 minutes). Note that even after setting the value, session may not be cleaned up immediately after the specified interval. Rather, it will be cleaned up after the specified time + a random interval.