• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Plesk and PHP sessions time out after 1 hour

Qbit

New Pleskian
We are creating a webapp that heavily uses sessions for users. We know that we needed to change some things to get this working and set the maxlifetime in the php.ini to one day instead of 1440 seconds. PHP 7.1

So our first thought was to add the maxlifetime to the Additional directives for the specified domain.
session.gc_maxlifetime = 86400

It will override the php.ini session.gc_maxlifetime = 1440 setting. After that we did
echo ini_get("session.gc_maxlifetime"); and it shows session.gc_maxlifetime = 86400. However when we started testing with some users they experienced timeouts. Also added session.gc_maxlifetime = 86400 to php.ini PHP 7.1

I just went through a day troubleshooting try and find the cause of sessions timing out. I finally found a plesk job that runs every hour by this cron script: plesk-php-cleanuper

The maxlifetime script is supposed to scan for all existing php.ini files, find the session.gc_maxlifetime value that is the largest configured value, then use it to determine when to actually clear out old sessions from the session directory.

After some testing the maxlifetime script only searches in standard OS-installed php.ini 5.4

This means that even if you’ve configured session.gc_maxlifetime to be longer than 1 hour for any given domain within Plesk, it will still have its session files cleared somewhere between the default of 24 minutes and 60 minutes.

Is there any solution for this?

Also i dont like to change php.ini for this to work because we have more than a dozen plesk servers. Best practice will be if we add the session.gc_maxlifetime to the Additional directives for the specified domain

extra info;

Version Plesk Onyx v17.5.3_build1705170317.16 os_CentOS 7
OS CentOS Linux 7.2.1511 (Core)
 
Last edited:
Back
Top