Debian lenny の PHP セッション GC メモ

Debian lenny の PHP セッションは、ファイルを CRON で削除していた。
そして、php.ini の設定で セッションGC は無効な状態だった。

php.ini を見ると、コメントで以下のように書かれている。

; This is disabled in the Debian packages, due to the strict permissions
; on /var/lib/php5.  Instead of setting this here, see the cronjob at
; /etc/cron.d/php5, which uses the session.gc_maxlifetime setting below.
; php scripts using their own session.save_path should make sure garbage
; collection is enabled by setting session.gc_probability

セッション GC を有効にしたい場合は、セッションの保存先(session.save_path) を変更せよとのこと。(もちろん session.gc_probability も適切に設定する。)
また、セッションの保存先をDBなどに変更していたなら、同様の削除処理が必要。
そのままだと古いセッション情報が残ったままになる。