-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
  • 34,294
  • 55
  • 151
  • 222
0

To get:

ini_get('session.gc_maxlifetime');

To set:

ini_set(‘session.gc_maxlifetime’,SOME_VALUE);
barfoon
  • 27,481
  • 26
  • 92
  • 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
  • 139,544
  • 27
  • 275
  • 264
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,694
  • 2
  • 21
  • 33