retrieve the session timeout from the php server

advertisements

I want to retrieve the value of session.gc_maxlifetime from the PHP server settings ( the time after which the session expires after no activity ). Very important : I do not want to change it, I only wish to retrieve its value ( maybe the value is different from server to server ) and I want to use a PHP script that I made to warn users properly, depending on the settings of those server.

Thank you.


That's where ini_get function comes in hand:

$maxlifetime = ini_get("session.gc_maxlifetime");

From manual we read:

session.gc_maxlifetime integer session.gc_maxlifetime 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).