Apologies for spamming the comments here, but it seems that Ubuntu (and/or Debian's) PHP garbage collection handling may be the culprit.

I can't speak for Debian OS on the whole, but in the Ubuntu derivative, there's a cron job that is executed on a scheduled basis, which cleans-up PHP session data. The shell script that is called is /etc/cron.d/php5. This script calls another in turn, /usr/lib/php5/maxlifetime. When I call this script directly, it outputs "24", which represents the number of minutes after which a PHP session data file is considered stale and eligible for destruction.

The script recurses through the various PHP configuration directories on the system and looks for session.gc_maxlifetime values that are larger than the default (hard-coded to 1440 seconds, at the top of the script).

So, I think the cause of this symptom's manifestation in PMA is this garbage collection script. The longer explanation is probably that even though the PMA location in the web-server is configured with session.gc_maxlifetime = 2592000, the garbage collection cron script does not take this configuration into account and instead looks to various php.ini files in an effort to discern the largest value for session.gc_maxlifetime that it can find. This approach "kind of makes sense", because it ensures that garbage collection will not occur prematurely in any scenario (except the one that we have stumbled upon here).

I modified a copy of this script to shed some light on what checks it performs:

Checking /etc/php5/apache2/php.ini
session.gc_maxlifetime = 1440

Checking /etc/php5/cgi/php.ini
session.gc_maxlifetime = 1440

Checking /etc/php5/fpm/php.ini
session.gc_maxlifetime = 1440

The simple fix: set session.gc_maxlifetime to the desired value in the appropriate file, as named above.

Note also that there is an "else" condition for

for sapi in apache2 apache2filter cgi fpm; do

which is

for ini in /etc/php5/*/php.ini /etc/php5/conf.d/*.ini; do

This means that which php.ini to modify depends on your PHP configuration.

Last edit: Ben Johnson 2013-12-20