Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

session already started warnings

Within my app I find that I am constantly seeing errors/warnings regarding sessions and I'm not sure why.

It's the standard "<b>Notice</b>: A session had already been started - ignoring session_start() in <b>app\config\services.php</b> on line <b>144</b><br />"

style message

and the session service is registered as follows

/** * Start the session the first time some component request the session service */ $di->set('session', function() {

   $session = new SessionAdapter();

return $session;


It's the same whether or not I set session to be shared (true) or not. The warning here is being generated when I use $this->security->getToken() in a view to generate csrf token but I've seen other instances usually happening when one of my views contains a call to content()

Does anyone know why this would be and how I can stop it from happening? Normally I'd use output buffering to suppress these errors but I'm not sure what's going on here



Never mind I worked it out. The issue is that I've implemented the Facebook SDK. This makes a call to session_start() if it doesn't already exist and I was calling this before my session has been set-up. I've amended my code to now take this into account and actually make sure my session is started before I instantiate my Facebook object