Not in every case. Because there are known issues with lost sessions and redirects. If you already put session_start() in your bootstrap file and it still not working then it’s not enough or another (setup) issue? Have you tried to add the middleware?
Yes I have but even that doesnt seem to keep the data…
// Add Twig-View Middleware
// Register Middleware To Be Executed On All Routes
'name' => getenv('APP_NAME'),
'autorefresh' => getenv('APP_SESSION_AUTOREFTESH'),
'lifetime' => getenv('APP_SESSION_LIFETIME'),
'secure' => getenv('APP_SESSION_SECURE'),
'httponly' => getenv('APP_SESSION_HTTPONLY'),
//$app->add(new FlashMessageMiddleware($container)); #TODO this is giving problems
// The RoutingMiddleware should be added after our CORS middleware so routing is performed first
/*SHOULD BE LAST MIDDLEWARE*/
$app->addErrorMiddleware(getenv('APP_DEBUG'), true, true);
It’s good to know now. The more context, the better we can help.
Then you already have a session middleware and should let the middleware start the session. You can / should remove your custom session_start() function call in your bootstrap file then. Better let the middleware handle the session start.