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

because_of's avatar

Session not persisting,always lost session,TokenMismatchException in VerifyCsrfToken

laravel 5.1/XAMPP Version: 5.6.8/Windows 7 Ultimate SP1 64-bit/php 5.6.8

Always lost authentication session after login.

Got token mismatch exception when send post request.

TokenMismatchException in VerifyCsrfToken.php line 53:

I found this also a session issue.

There are many similar issue,if search "session" keyword.

https://laracasts.com/discuss?q=session

And I have not find any correct solution yet.

0 likes
6 replies
because_of's avatar

Get back the lost session,if I run this code:

Route::get('session', function() { return Session::all(); });

Then print session:all()

There are something new in session data:

[_previous] => Array ( [url] => http://... ) [flash] => Array ( [old] => Array ( ) [new] => Array ( ) )

Whats the defferent?

alejometal's avatar

Hi, Friends, Check on file driver the size of each session file, and check the datatype of payload field on session table, that is by default TEXT which in mysql are 64kb, if the session files are greater than that, try to change datatype of payload field to MEDIUMTEXT or something more fit.

1 like

Please or to participate in this conversation.