Tiempo de espera predeterminado de las sesiones de PHP [duplicar]


Esta pregunta ya tiene una respuesta aquí:

¿El tiempo de espera de las sesiones de PHP por defecto, es decir, sin ningún tipo de codificación por mi parte, un usuario eventualmente sería "desconectado" después de algún tiempo de inactividad?

Author: KB., 2012-03-28

6 answers

Depende de la configuración del servidor o de las directivas correspondientes sesión.gc_maxlifetime en php.ini.

Normalmente el valor predeterminado es de 24 minutos (1440 segundos), pero tu webhost puede haber alterado el valor predeterminado a otra cosa.

 103
Author: Niet the Dark Absol,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-02-26 16:25:38

Puede cambiarlo en su configuración php en su servidor web. Buscar en php.ini para

session.gc_maxlifetime() El valor se establece en segundos.

 15
Author: suther,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-05-04 09:19:55

Sí, eso suele suceder después de 1440 (24 minutos)

 7
Author: haltabush,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-05-13 14:09:49

Http://php.net/session.gc-maxlifetime

session.gc_maxlifetime = 1440
(1440 seconds = 24 minutes)
 5
Author: Elangovan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-07-09 13:52:59

Sí típicamente, una sesión terminará después de 20 minutos en PHP.

 3
Author: Jeroen,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-03-28 08:54:15

Puede establecer el tiempo de espera de la sesión en php.ini. El valor predeterminado es 1440 segundos

session.gc_maxlifetime = 1440

; NOTE: If you are using the subdirectory option for storing session files
;       (see session.save_path above), then garbage collection does *not*
;       happen automatically.  You will need to do your own garbage
;       collection through a shell script, cron entry, or some other method.
;       For example, the following script would is the equivalent of
;       setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
;          find /path/to/sessions -cmin +24 -type f | xargs rm
 2
Author: Rafeeque KP,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-09-06 09:51:03