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

RafaelMunoznl's avatar

All my Apps run in Windows but get "419, session has expired" in Mac

I have been building Apps with Laravel in a Windows computer since two years. They run perfectly in a Desktop and two Laptops. Always in Windows.

I cloned the project into the company laptop which is a Mac. It is a normal routine process to clone a Laravel project that I have made dozens of times. Allways in Windows computers

  1. Clone project from Github: git clone https:github/…..
  2. Install vendors directory (dependencies)
composer update --no-scripts
  3. Create a new database.
  4. Set up Database Connection, rename .env.example to .env and edit password, database, name, etc
  5. Setup the Key: php artisan key:generate:
  6. Migrate the project to create the tables in the database: php artisan migrate.
  7. Run the application

The apps work, but when I try to login, I get the following message:

419 Sorry, your session has expired. Please refresh and try again.

I know it should be a trivial problem, but I am a (convinced) Windows user. I have google for it, but this problem is always related to the CSRF, but in my case I did not change a single line and it works in Windows.

I am using XAMPP for Mac, PHP version: 7.3.1 and MySQL 5.0. It fails in Chrome, Firefox and Safari.

Any idea?

0 likes
16 replies
jlrdw's avatar

Double check your storage folder permissions.

RafaelMunoznl's avatar

@JLRDW - Permission on that folder were "REad only". Now I have changed the permission to Read & Write" and it did not have any effect. I am still not able to log in into the Apps and get the 419 error

MaverickChan's avatar

@RAFAELMUNOZNL - try php artisan serve in 127.0.0.1:8000 , see if it works.

if so , then your project is fine , it should be a browser issue.

chrome ( assuming you are using ) need a hard refresh.

if does not work , run php artisan cache:clear and php artisan view:clear

tanertombas's avatar

I think permission problem, Check the storage permission for creation sessions and try logging in. Check if the created session exists in the storage folder.

ADEVO's avatar

Hi Rafael, for me it's always CSRF. No matter which is your problem, it should be easy fix, with a lot of hints for problem. Start with logging incoming request for one of your controllers. Anyway, check /storage/logs/laravel.log for some necessary information.

As for migrating from Windows to MAC, there should not be any problems with versions or plugins at least if you're not using something specific.

One problem may occur only with "/" or "" element, if you have hardcoded some paths or something. Btw, how are you inputing CSRF field, manualy or with blades csrf_field() ?

RafaelMunoznl's avatar

@ADEVO - I am using blade and Laravel Collective package. CSRF ist automatically added in each of my forms. And those forms are working perfectly since a couple of years

mnkous's avatar

@rafaelmunoznl I'm facing the exact same problem, did you manage to solve this, and if yes: how did you solve this?

oriolrg's avatar

I have more or less the same problem. In my case the error is reproduced only in chrome browser and mobile phone safari. On PC it works correctly. Does this mean that laravel is not operational for phone browsers?

@rafaelmunoznl Did you manage to solve the problem?

RafaelMunoznl's avatar

@mnkous It was a long time ago, but unfortunatelly I did not get any solution for that.

I just abandoned MAMP/XAMPP and started to use docker.

RafaelMunoznl's avatar

@oriolrg It was a long time ago, but unfortunatelly I did not get any solution for that.

I just abandoned MAMP/XAMPP and started to use docker.

oriolrg's avatar

So I can not publish an app created by laravel and that can be used from any platform, be it PC, MAC, iphone or android?

RafaelMunoznl's avatar

@oriolrg I think we are talking about different things here:

I was not able to make it work in local enviroment using MAc+ XAMPP/MAMPP. (In development)

But of course, once in production, Laravel works in any platform, browser or device. I would have a look to the logs.

oriolrg's avatar

Ok I talk in production. Laravel works in all plataforms but safari and android chrome not. I try other plataforms build in laravel and the problem is the same. For example, https://documentator.io/login With this I don't know who is the developer, but I have the same issue.

RafaelMunoznl's avatar

@oriolrg I can not know from here which is the problem, but there are thousands of Webapps out there built in Laravel. Otherwise would not be so popular.

As example is Laracast.com or even Laravel.com. These two portals work perfect in any plattforrm, browser and device

oriolrg's avatar

The públic part works perfect, the problem us with login session

oriolrg's avatar

In fact in laracasts.com I haver t'he same issue with Android Chrome browser

Please or to participate in this conversation.