Skip to content
Merged
Changes from 1 commit
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
28 changes: 24 additions & 4 deletions cookbook/session/sessions_directory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,23 @@
Configuring the Directory where Sessions Files are Saved
Copy link
Member

Choose a reason for hiding this comment

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

uppercase where

Copy link
Author

Choose a reason for hiding this comment

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

OK, but this was already in the file before I edited it.

Copy link
Member

Choose a reason for hiding this comment

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

I didn't mean to blame you for this. We recently clarified our standard on headlines. Thus, I think it's a good point to change it now.

========================================================

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.
By default, Symfony stores the session data in files in the cache
directory `"%kernel.cach_dir%/sessions"`. This means that when you clear
Copy link
Member

Choose a reason for hiding this comment

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

you must use double backticks in reSt

the cache, any current sessions will also be deleted.

.. note::

If the ``session`` configuration key is set to ``~``, Symfony will use the
global PHP ini values for ``session.save_handler``and associated
Copy link
Contributor

Choose a reason for hiding this comment

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

missing space before and

``session.save_path`` from ``php.ini``.

.. note::

While the Symfony Full Stack Framework defaults to using the
``session.handler.native_file``, the Symfony Standard Edition is
configured to use PHP's global session settings by default and therefor
sessions will be stored according to the `session.save_path` location
Copy link
Contributor

Choose a reason for hiding this comment

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

missing double ticks

and will not be deleted when clearing the cache.

Using a different directory to save session data is one method to ensure
that your current sessions aren't lost when you clear Symfony's cache.
Expand All @@ -30,18 +44,24 @@ session directory to ``app/sessions``:
# app/config/config.yml
framework:
session:
handler_id: session.handler.native_file
save_path: "%kernel.root_dir%/sessions"

.. code-block:: xml

<!-- app/config/config.xml -->
<framework:config>
<framework:session handler-id="session.handler.native_file" />
<framework:session save-path="%kernel.root_dir%/sessions" />
</framework:config>
Copy link
Member

Choose a reason for hiding this comment

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

<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:framework="http://symfony.com/schema/dic/symfony"
    xsi:schemaLocation="http://symfony.com/schema/dic/services
        http://symfony.com/schema/dic/services/services-1.0.xsd
        http://symfony.com/schema/dic/symfony
        http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
>
    <framework:config>
        <framework:session handler-id="session.handler.native_file" />
        <framework:session save-path="%kernel.root_dir%/sessions" />
    </framework:config>
</container>


.. code-block:: php

// app/config/config.php
$container->loadFromExtension('framework', array(
'session' => array('save-path' => "%kernel.root_dir%/sessions"),
'session' => array(
'handler-id' => "session.handler.native_file"),
'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.

use single quotes instead of double quotes here

Copy link
Member

Choose a reason for hiding this comment

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

and remove the ), part from both

Copy link
Author

Choose a reason for hiding this comment

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

@wouterj No, that's valid PHP syntax.

Copy link
Member

Choose a reason for hiding this comment

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

No, there are more closing parentheses then opening ones.

Copy link
Member

Choose a reason for hiding this comment

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

2 more to be precise :)

),
));