symfony/symfony — Issue #3463: [FrameworkBundle] Sessions - default session directory is unexpected
Author: pcampr
Created: 2012-02-27 22:17:39+00:00
State: open

As defined in Symfony/Bundle/FrameworkBundle/Resources/config/session.xml:

%kernel.cache_dir%/sessions
%session.storage.options%

and with default session.storage.native_file.class = Symfony\Component\HttpFoundation\Session\Storage\NativeFileSessionStorage,

all session files are stored in app/cache/[env]/sessions directory by default. This is unexpected behavior, normally I would expect to have these files in directory defined in php config "session.save_path".

Current solution has 3 drawbacks:

1. it's unexpected, normally I wouldn't search for my session files in app/cache/[env]/sessions, when my php session.save_path is set to something else,
2. when I call cache:clear task, all session files are deleted,
3. garbage collectors for session files (in Debian it's cron task) don't know about app/cache/[env]/sessions directories so that they are not purged

%kernel.cache_dir%/sessions default argument for session.storage.native_file service should probably be replaced by php session.save_path value when available

(my php config is (debian default): session.auto_start off, session.save_handler files, session.save_path /var/lib/php5)