-4

Possible Duplicate:
PHP : What is the default lifetime of a session

What's the default session lifetime in PHP? Can it be changed?

Community
  • 1
  • 1

4 Answers4

2

You can get your default session life time by doing this:

echo ini_get('session.gc_maxlifetime');

To set your own session life time or to extend it, do this:

ini_set('session.gc_maxlifetime', 30*60); // Can be changed to anything in seconds
MacMac
  • 32,380
  • 54
  • 146
  • 219
0

To get:

ini_get('session.gc_maxlifetime');

To set:

ini_set(‘session.gc_maxlifetime’,SOME_VALUE);
barfoon
  • 26,527
  • 25
  • 91
  • 138
0

It's in your php.ini file. It defaults to 24 minutes, but it's easy to change.

Look for session.gc_maxlifetime and set to to the value you want in seconds.

Paul
  • 135,475
  • 25
  • 268
  • 257
0

The default in the php.ini for the session.gc_maxlifetime directive (the "gc" is for garbage collection) is 1440 seconds or 24 minutes.

see: PHP : What is the default lifetime of a session

Community
  • 1
  • 1
Andreas
  • 2,664
  • 2
  • 20
  • 33