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

Galago's avatar

Tokenmismatch and HTTP ERROR 500

Hello,

I have quite a weird problem. I am trying to put my local Laravel project on a server for a school project. Initialy this wasn't working because of the storage folder which didn't have permissions.

When I fixed that, I could enter the /login page (with Laravels built-in auth system). But when I try to login, I get a TokenMismatchException exception. And when I try to go to a page rather than /login, /register for example, I get a HTTP ERROR 500. I am getting this only with defined routes (so /register). Routes that don't exist return a normal NotFoundHttpException.

Does anyone know what is causing this problem? We are using HTTPD on the server, PHP7 and running on CentOS 7. There is nothing in the the httpd (php) error logs. Do I have to enable something? Or am I missing something?

There is a live preview here, so you can see it for yourself: https://www.team-schnitzel.nl/login

Thanks in advance!

EDIT: I have the CSRF-line in my HTML.

0 likes
2 replies
Galago's avatar
Galago
OP
Best Answer
Level 1

It is fixed. We disabled SELinux and now it is working.

cburgosro's avatar

My english it's not good, excuse me if i'm not clear.

I believe that you shouldn't disabled SELinux, it's to possible that your problem it's only the context of the file, then you should if laravel need read or read and write then give the correct context.

if only need read you have to use

sudo chcon -R -t httpd_sys_content_t [path_of_your_directory]

else if need read and write you have to use

sudo chcon -R -t httpd_sys_rw_content_t [path_of_your_directory]

take care with

-R

use if you need give this context recursively else only with -t

Help whenever you can

CBR

Please or to participate in this conversation.