7

I want to up the time my users will stay logged into my site without getting automatically logged out after a period of inactivity. I'm tracking the logged in status using PHP sessions.

How can I set this, I'm trying to control this from my .htaccess file.

2

2 Answers 2

17

You can't do that from the htaccess file but You can change this line in your php.ini file.

session.gc_maxlifetime = 1440

Update: it seems to be possible, so i stand corrected

php_value session.gc_maxlifetime 3600

I haven't tried this out though.

Sign up to request clarification or add additional context in comments.

1 Comment

Also take into account the max cookie lifetime.
7

You could also try changing the value at runtime using ini_set:

ini_set('session.gc_maxlifetime', '3600');

1 Comment

can we do it in a shared hosting?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.