1

I am getting a session timeout all the time.

When ever a user is idle for some time, he has to re-login. I want him to login again only if he closes his browser. I have not used anything to destroy or unset the session, I only do that in the logout page.

I have set my PHP INI file to set all the session variables. You can browse the Session Variable here at the link.

http://www.providentfeed.com/phpinfo.php

2
  • Possibly a duplicate of stackoverflow.com/questions/5577106/… Commented Apr 17, 2011 at 10:35
  • Thanks Gordon for your directions, but I already have set these two parameters(session.cookie_lifetime and session.gc_maxlifetime) to 40 hours. But it is not working. Commented Apr 17, 2011 at 13:03

2 Answers 2

6

you can write the following code in your php file.

// Session timeout value in seconds. Let's say we increase it to 24 hours
ini_set('session.gc_maxlifetime', 24*60*60);
Sign up to request clarification or add additional context in comments.

1 Comment

Naveed thank you for your reply. Actually I tried this before in my PHP code, it did not worked. Then I tried it in PHP.ini file. Still the same issue.
1

That's standard behavior. If you want the user to be logged in indefinitely, you'll need to create a cookie and check for its presence in the login page. And simply log the user in if the cookie exists.

1 Comment

Actually it is a big application and not using some MVC so that I can do it easily. I think there will be some solution to keep the session for a couple of hours. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.