From cae8707fa2edb0e2fa231fbb66d8a9b7ae9f5505 Mon Sep 17 00:00:00 2001 From: Kevin Weber Date: Mon, 27 May 2013 16:26:58 -0400 Subject: [PATCH] Added cookbook page about sessions directory. --- cookbook/session/index.rst | 1 + cookbook/session/sessions_directory.rst | 50 +++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 cookbook/session/sessions_directory.rst diff --git a/cookbook/session/index.rst b/cookbook/session/index.rst index 687148dcd10..5620249be8a 100644 --- a/cookbook/session/index.rst +++ b/cookbook/session/index.rst @@ -5,3 +5,4 @@ Sessions :maxdepth: 2 proxy_examples + sessions_directory diff --git a/cookbook/session/sessions_directory.rst b/cookbook/session/sessions_directory.rst new file mode 100644 index 00000000000..7d8b192b1d9 --- /dev/null +++ b/cookbook/session/sessions_directory.rst @@ -0,0 +1,50 @@ +.. index:: + single: Sessions, sessions directory + +Configuring Sessions Directory +============================== + +By default, Symfony stores the session data in the cache directory. This +means that when you clear the cache, any current sessions will also be +deleted. + +Using a different directory to save session data is one method of retaining +current sessions during a clearing of the cache. + +.. tip:: + + Using a different session save handler is an excellent (yet more complex) + method of session management available within Symfony. See + :doc:`/components/http_foundation/session_configuration.rst` for a + discussion of session save handlers. + +To change the directory in which Symfony saves session data, you only need +change the framework configuration. In this example, we are changing the +session directory to 'app/sessions': + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config.yml + + framework: + session: + save_path: %kernel.root_dir%/sessions + + .. code-block:: xml + + + + + + + + .. code-block:: php + + // app/config/config.php + + $container->loadFromExtension('framework', array( + 'session' => array('save-path' => "%kernel.root_dir%/sessions"), + )); +