Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

umefarooq's avatar

Laravel 5.3 session is not presistant

Laravel 5.3 every request generate new session I always face token mismatch problem and after successful login no session saved I'm using xampp as server on windows

0 likes
6 replies
SaeedPrez's avatar

@umefarooq

Some people seem to have problem with session when using @endsection in their blade templates, try changing them to @stop and see if that helps..

It can also be caused if you have a blank space or anything before <?php in one of your files,..

Another possibility is too strict permissions to the storage/framework/sessions folder..

Also make sure APP_URL is correct in your .env file, might cause cookie problems..

umefarooq's avatar

@SaeedPrez thanks I will check blade thing I have already set app_URL in .env file laravel creating session files on each request, but locally on my mac development machine everything works fine I have saved same problem in laravel 5.2 project

Bounoable's avatar

This can also happen when you don't "return" from your controller, but instead "die" or "exit" out of a controller

umefarooq's avatar

@Bounoable I'm returning everything from controller simple laravel auth not able to set session after successful login

Bounoable's avatar

Make sure that the route to the AuthController has the "web" middleware group applied, otherwise the session will not start.

umefarooq's avatar

really bad luck no success, i'm leaving laravel development for some project because of server issue, now i have to develop whole project again in CI my old love :(

Please or to participate in this conversation.