webgui: prevent PHP session gc from running early (#6499)

With the default PHP settings, there is a 1% chance for the session gc
to trigger upon the start of a session, removing session files with
modification times older than 24 minutes. This can cause sessions to
timeout earlier than indicated by the webgui settings.
This commit is contained in:
lin-xianming 2023-04-18 12:23:15 -04:00 committed by GitHub
parent 86e48d3e45
commit 8f9d7e823b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -31,3 +31,4 @@ log_errors=on
error_log=/tmp/PHP_errors.log
date.timezone="{{system.timezone|default('Etc/UTC')}}"
session.save_path=/var/lib/php/sessions
session.gc_maxlifetime={{system.webgui.session_timeout|default(240)|int * 60}}

View File

@ -151,6 +151,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$newciphers = !empty($pconfig['ssl-ciphers']) ? implode(':', $pconfig['ssl-ciphers']) : '';
$restart_webgui = $config['system']['webgui']['protocol'] != $pconfig['webguiproto'] ||
$config['system']['webgui']['session_timeout'] != $pconfig['session_timeout'] ||
$config['system']['webgui']['port'] != $pconfig['webguiport'] ||
$config['system']['webgui']['ssl-certref'] != $pconfig['ssl-certref'] ||
$config['system']['webgui']['compression'] != $pconfig['compression'] ||