Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


How to let a PHP session expire after a time set by the application?

Damian99Damian99 USAMember Posts: 116

Please let me know how to keep a PHP session for a pre-defined time and then delete it.



  • DavidMDavidM USAMember Posts: 342
    $_SESSION['startTime'] = time(); // current time
    // end the session in 50 mins
    $_SESSION['expireTime'] = $_SESSION['start'] + (50 * 60);

    Then check the current time with the $_SESSION['expireTime'] when you want to check for a user login validation or any other form of validation.

Sign In or Register to comment.