File tree Expand file tree Collapse file tree 2 files changed +51
-0
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +51
-0
lines changed
Original file line number Diff line number Diff line change 5
5
:maxdepth: 2
6
6
7
7
proxy_examples
8
+ sessions_directory
Original file line number Diff line number Diff line change
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
+
You can’t perform that action at this time.
0 commit comments