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

Tejinder's avatar

Laravel 5.7.4 - Getting Error 419, Sorry Your Session has expired...

Hi,

I have a Laravel web application in Laravel version 5.7.4 hosted on Godaddy Shared hosting. Its working fine there.

But, I am facing issues while migrating the application to Godaddy VPS Server (Centos 7). After a successful application and database migration, the Static pages are working fine.

But, getting error 419 ("Sorry your session has expired. Please refresh and try again.") for all the POST requests, e.g Login form, admin login, etc. I have tried all options but no success.

The same application is working fine offline and on another server.

Can anyone please help me resolve this issue?

Regards, Tejinder

0 likes
10 replies
Nakov's avatar

Do you have a .env file in your app?

Have you run

php artisan key:generate

?

Or are you missing CSRF fields in the forms?

1 like
jove's avatar

Could also be the wrong url for the session?

Tejinder's avatar

Hi Nakov,

Yes I have already run this artisan command and have valid .env file present. Also I have run the following commands: php artisan cache:clear php artisan config:clear php artisan config:cache

But no success

Can you please suggest?

Thanks, Tejinder

Tejinder's avatar

Hi Nakov,

Yes I have already run this artisan command and have valid .env file present and using @csrf in all forms. Also I have run the following commands: php artisan cache:clear php artisan config:clear php artisan config:cache

But no success

Can you please suggest?

Thanks, Tejinder

Snapey's avatar

check to see if your application is sending any cookies. If not, you have something emmiting a response before the headers are sent.

This might have been an issue for a while, but only seems to affect apache - have you changed web server type?

Check your files to see if you have any characters or blank lines before <?php in your files

siangboon's avatar

try clear your browser cache or open in incognito mode?

Tejinder's avatar

Verified that correct URL. Still facing same issue.

Snapey's avatar

Did you check? Does your browser receive a cookie ?

alisajjad123's avatar

@tejinder i'm facing the same issue right now? i moved my project from shared hosting to the Godaddy VPS Server almalinux9 and im facing the same issue. Any solution you can suggest to fix the problem?

Please or to participate in this conversation.