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

Hassan Elshazly's avatar

Page Expired 419 on shared hosting

I have a popular problem trying to fix it for two days, but with no progress. It seams that it appear while uploading project to host. It show that Page expire 419, and every time I login it create a new session in (storage/framework/sessions) directory. I have tried many solutions following this issue in stack overflow and many others. I have tried to avoid CSRF Token by giving $except var my login route and it's continue progress without page expired but with a blank page only "Redirecting to .. {home}" without passing login method in controller.

0 likes
7 replies
jlrdw's avatar

Sounds like session is not being written. Are you sure your storage permissions are correct.

jlrdw's avatar

@Hassan Elshazly set something in a session on one page, go to another page see if you can read it.

csrf works on local development?

419 is csrf mismatch, but depends on session.

Hassan Elshazly's avatar

@jlrdw yes it work in local in handler i got #message: "CSRF token mismatch." i also add CSRF token in meta tag and in form

Hassan Elshazly's avatar

@jlrdw Also , SESSION_DOMAIN is null in env and session config, where as every time login a session files are being created,

Hassan Elshazly's avatar
Level 1

Finally after many search I found solution in stack-over flow , Inside your main index.php file inside public folder, edit it and at the very top write ob_start()

1 like
batsy3's avatar

for anyone experiencing this 419 error especially on ionos...try setting your session domain to the hosted domain excluding the https:/ part and make sure you have a meta tag specifying your csrf declaration

i.e SESSION_DOMAIN=yourDomain.com

Please or to participate in this conversation.