I would like to enable session in Symfony2, but I don't know how can I do that.
I set my config file like this:
#app/config/config.yml
framework:
session:
name: session
cookie_lifetime: 0
cookie_httponly: true
But it seems to my session is still disabled and not started. I tested this code in my controller:
echo ( session_status() !== PHP_SESSION_ACTIVE )
? "Session is not started!"
: "Session OK";
And it return "Session is not started!". It works only when I set:
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
But this is very ugly solution, especially that I am working in Symfony2. Do you have any ideas?