Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cae8707

Browse filesBrowse files
author
Kevin Weber
committed
Added cookbook page about sessions directory.
1 parent 34a9fa2 commit cae8707
Copy full SHA for cae8707

File tree

Expand file treeCollapse file tree

2 files changed

+51
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+51
-0
lines changed

‎cookbook/session/index.rst

Copy file name to clipboardExpand all lines: cookbook/session/index.rst
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ Sessions
55
:maxdepth: 2
66

77
proxy_examples
8+
sessions_directory
+50Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
.. index::
2+
single: Sessions, sessions directory
3+
4+
Configuring Sessions Directory
5+
==============================
6+
7+
By default, Symfony stores the session data in the cache directory. This
8+
means that when you clear the cache, any current sessions will also be
9+
deleted.
10+
11+
Using a different directory to save session data is one method of retaining
12+
current sessions during a clearing of the cache.
13+
14+
.. tip::
15+
16+
Using a different session save handler is an excellent (yet more complex)
17+
method of session management available within Symfony. See
18+
:doc:`/components/http_foundation/session_configuration.rst` for a
19+
discussion of session save handlers.
20+
21+
To change the directory in which Symfony saves session data, you only need
22+
change the framework configuration. In this example, we are changing the
23+
session directory to 'app/sessions':
24+
25+
.. configuration-block::
26+
27+
.. code-block:: yaml
28+
29+
# app/config/config.yml
30+
31+
framework:
32+
session:
33+
save_path: %kernel.root_dir%/sessions
34+
35+
.. code-block:: xml
36+
37+
<!-- app/config/config.xml -->
38+
39+
<framework:config>
40+
<framework:session save-path="%kernel.root_dir%/sessions" />
41+
</framework:config>
42+
43+
.. code-block:: php
44+
45+
// app/config/config.php
46+
47+
$container->loadFromExtension('framework', array(
48+
'session' => array('save-path' => "%kernel.root_dir%/sessions"),
49+
));
50+

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.