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
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
Share on other sites

  • 5 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.