• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

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