Skip to content

Added cookbook page about sessions directory. #2670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 30, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cookbook/session/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Sessions
:maxdepth: 2

proxy_examples
sessions_directory
50 changes: 50 additions & 0 deletions cookbook/session/sessions_directory.rst
Original file line number Diff line number Diff line change
@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jou must remove the extension for doc links

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

always avoid a form of 'we' in the docs

session directory to 'app/sessions':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put app/sessions in a literal (double backticks)


.. configuration-block::

.. code-block:: yaml

# app/config/config.yml

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should remove this empty line

framework:
session:
save_path: %kernel.root_dir%/sessions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

% is a reserved character in yaml, it should be between quotes:

save_path: "%kernel.root_dir%/sessions"


.. code-block:: xml

<!-- app/config/config.xml -->

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this empty line

<framework:config>
<framework:session save-path="%kernel.root_dir%/sessions" />
</framework:config>

.. code-block:: php

// app/config/config.php

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

$container->loadFromExtension('framework', array(
'session' => array('save-path' => "%kernel.root_dir%/sessions"),
));