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

sephter's avatar

TokenMismatchException in compiled.php line 2440:

Hi everyone

First, sorry for bad english, i sometimes speak english like a spanish cow.

I'm learning php and laravel and have a little problem. I added a scriptwall (for facebook-like functionalities) . I see it (the messages loading is working) but when i'm trying to save a new message (wich sould add a new entry in the database) i receive this message:

Whoops, looks like something went wrong.

1/1
TokenMismatchException in compiled.php line 2440:
in compiled.php line 2440
at VerifyCsrfToken->handle(object(Request), object(Closure)) in VerifyCsrfToken.php line 17
at VerifyCsrfToken->handle(object(Request), object(Closure)) in compiled.php line 8944
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 12083
at ShareErrorsFromSession->handle(object(Request), object(Closure)) in compiled.php line 8944
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 10785
at StartSession->handle(object(Request), object(Closure)) in compiled.php line 8944
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 11789
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in compiled.php line 8944
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 11738
at EncryptCookies->handle(object(Request), object(Closure)) in compiled.php line 8944
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 2478
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in compiled.php line 8944
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in compiled.php line 8935
at Pipeline->then(object(Closure)) in compiled.php line 1891
at Kernel->sendRequestThroughRouter(object(Request)) in compiled.php line 1880
at Kernel->handle(object(Request)) in index.php line 53

The script is in ./wall (because it is an external resource) and the article.blade contains:

<?php include(app_path().'/../wall/index.php'); ?>

I think this problem is linked to laravel because the wall is working fine when not in laravel repository. Does anyone have a suggestion about how to fix that? Thanks by advance

0 likes
5 replies
bobbybouwmann's avatar
Level 88

You probably miss this in your form

<input type="hidden" name="_token" value="{{ csrf_token() }}">

This is Laravel specific!

1 like
bobbybouwmann's avatar

@adenoe I mean any form that has the crsf middleware. If you have a question please create a new thread ;)

Please or to participate in this conversation.