Symfony2 : Failed to start the session because headers have already been sent Symfony2 : Failed to start the session because headers have already been sent symfony symfony

Symfony2 : Failed to start the session because headers have already been sent


So I figured it out. In the 2nd action where I was calling

$session->getRequest()->getSession(); 

I had to change that to

$session = new Session();$session->start();

Go figure. :P


I've get the same error. But in my case I've placed some spaces in the AppKernel.php before the < ?phptag. So if someone else get this error, checkout if you have some spaces or tabs before in first line of each .php file which get loaded before session get initialized.


This happens to me when in some of the scripts that anticipate $this->session->start(); there is a echo statement!Hope this can help someone else debugging the issue