Session expiration

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mzfp2
Forum Contributor
Posts: 137
Joined: Mon Nov 11, 2002 9:44 am
Location: UK
Contact:

Session expiration

Post by mzfp2 »

Hi

is it possible to define a fixed time for which a session will stay active for? At the moment my sessions expire too frequently and is annoying users a bit !

Thanks
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

It may be the session.cache_expire setting in your PHP.ini (it defaults to 180), so try changing that. If you don't have access to the PHP.ini you can use:

Code: Select all

<?php
session_cache_expire(180);
?>
At the top of every page, before session_start(), to set the cache expire for 180 minutes.
Post Reply