[php-maint] Bug#626640: Premature session file deletion

Marcus Cobden debian-bugs at marcuscobden.co.uk
Fri May 13 22:14:34 UTC 2011

Package: php5-common
Version: 5.3.6-10

The crontab /etc/cron.d/php5 will, in certain circumstances, prematurely delete session files, resulting in error messages in scripts which were using those sessions.

Circumstances in which this might occur are:
* A script has been running longer than the configured session maxlifetime, and still has a session open.
* A script which as resumed an existing session, but the end of the session maxlifetime falls within the window of that script's execution.

This is a pretty common problem, and any number of kludgy solutions can be found in google, I didn't spot any which actually address the cause of the problem, only workarounds.

Suggested fix:
In the crontab, replace



-exec sh -c 'C=`fuser "$0" 2> /dev/null | wc -w`; [ "$C" -eq 0 ] && rm "$0"' {} \;

More information about the pkg-php-maint mailing list