It looks like you have done the basic troubleshooting steps and the upgrade guide has nothing specific.
If you spin up a new 5.7 application and migrate your code does it work?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hey, after updating my packages, going from 5.6.34 to 5.7.19, I keep getting this error when trying to log in, register, whatever form post with csrf.
Keeps throwing \Illuminate\Session\TokenMismatchException
Every form contains @csrf.
I've tried basically everything that people suggested when googling:
Deleted storage/framework/cache/data folder, made sure proper rights are set on storage/framework/cache.
Made sure everything is correct based on the 5.6 > 5.7 upgrade guide.
Made sure my form contains the csrf token, made sure my header also contains the token just in case (tried both @csrf & {{ csrf_field() }}).
Made sure my session.php contains 'domain' => env('SESSION_DOMAIN', null),.
Made sure my .env doesn't contain SESSION_DOMAIN.
Regenerated my APP_KEY.
Made sure my system date is correct.
Checked my SESSION_DRIVER is still file in .env.
Flushed caches via php artisan optimize:clear.
Dumped autoload via composer dump-autoload.
I.. think I'm on a dead end.. any suggestions?
Okay.. I just found out the issue.
I had an ExtendedStartSession class which I've used to not count a certain route as previous.
Seems like something has changed during the upgrade and it broke, I'll investigate what broke and rewrite the code properly.
CSRF verification now works aswell, but I greatly appreciate your suggestions @realrandyallen as that reminded me that I've messed with that middleware a while ago.
Thus.. solved :)
Please or to participate in this conversation.