Jump to content

SESSION Timeout Issue


anthonynguyen

Recommended Posts

Hi Guys,

 

I am new to PHP development and had a question with using SESSIONs in PHP and how do I set the session timeout in code.  I tried a few code I found on the web but they only appear to work on a Windows environment.  I am trying to get this to work within an Apache Server on a Linux box.  In my code I detect if a session still exist and if not, they get redirected back to the login page.  I want the session to timeout after 20 mins of inactivity.  Sorry if this sounds like a stupid question but I come from an ASP/ASP.NET and ColdFusion background.  It is set easily in those languages.  Code examples that worked on Apache Web Servers in a LINUX environment would be awesome.

 

Thankas ahead of time for all the help.

 

- Anthony

Link to comment
https://forums.phpfreaks.com/topic/38880-session-timeout-issue/
Share on other sites

Thanks.  Sorry I wasn't clear on what I was looking for.  I tried a few options to set the session timeout in code.

 

<?php
      ini_set('session.gc_maxlifetime', 1200);    //this didn't work in Windows or Linux
      ini_set('session.cookie_lifetime', 900);     //this worked in Windows but not Linux
      session_set_cookie_params(900);          //this worked in Windows but not Linux
?>

 

I need some piece of code that will timeout the session after 20 mins.

Link to comment
https://forums.phpfreaks.com/topic/38880-session-timeout-issue/#findComment-187132
Share on other sites

  • 5 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.