On my Debian Wheezy, every half-hour a cron job runs:
find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -ignore_readdir_race -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null \; -delete)
This deletes oldish PHP state/session files. I would like to drop this cron job altogether, or at least decrease its frequency. In which of the following use-cases is that possible?
- A server which has no PHP code running
- A server with the odd page with PHP here and there, but nothing serious like a CMS
- A server running, say, some PHP CMS, with user sessions, but with not too many page views (say up to 50,000 a month)
/etc/cron.d/php5
and add specific jobs, or adjust the php.ini settings so that PHP handles garbage collection like what happens on most other systems by default. Or even better, switch your session handler out and make your sessions database or memory based.