Jump to content

Sessions in Symfony 3


Recommended Posts

Hi. First post here.


I am currently developing an application for a client. We elected to go with Symfony 3 and PHP 7 for the build to give it a longer lifespan. I am currently working with session management and it appears that for some reason Symfony is auto starting the session. I am entirely unsure why it is doing this or where it is being told to. I verified that the session auto start was disabled in php.ini and I have check the YML config files for Symfony.


I tested for this with the following code:

$session = $this->container->get('session')->isStarted();

        echo $session;

It returned a value of 1. What am I missing?

Link to comment
Share on other sites



Symfony sessions are designed to replace several native PHP functions. Applications should avoid using session_start(), session_regenerate_id(), session_id(), session_name(), and session_destroy() and instead use the APIs in the following section.


While it is recommended to explicitly start a session, a session will actually start on demand, that is, if any session request is made to read/write session data.


Symfony sessions are incompatible with php.ini directive session.auto_start = 1 This directive should be turned off in php.ini, in the webserver directives or in .htaccess.

  • Like 1
Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.