0

I've observed that my PHP pages in the production environment session times out but unable to figure out what determines the duration of time out.

I use AWS ElasticBeanstalk to run the PHP code.

I'd like to find out

  • what is the session time set to and where is it set typically?
  • how I can programmatically control the time out from the PHP layer

Thanks in advance

user4826347
  • 783
  • 2
  • 11
  • 29

1 Answers1

1

If the session timeout is not explicitly set through the code, then you can check the default value set in the php.ini file for session.gc_maxlifetime which specifies the number of seconds after which data will be seen as 'garbage' and potentially cleaned up. Garbage collection may occur during session start (depending on session.gc_probability and session.gc_divisor). Defaults to 1440 (24 minutes).

References:-

session.gc_maxlifetime

PHP - How to implement session lifetimes

Arpit Jain
  • 1,599
  • 9
  • 23
  • The instance is loaded in AWS elastic beanstalk. how would I find the php.ini file and its content in such cases? – user4826347 Feb 12 '23 at 20:20
  • 1
    If you don't have access to the instances, then you can use `phpinfo();` in the code to show all information, defaults to INFO_ALL. – Arpit Jain Feb 13 '23 at 04:52