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

Cheebamba's avatar

New session on every reload

Hi, I'm creating laravel app on my localhost, and every time i reload/refresh website I get new session ID. How to fix this?

0 likes
7 replies
jlrdw's avatar

Check your storage folder permissions.

Cheebamba's avatar

Im running Windows, and there are files in 'storage\framework\sessions'

jlrdw's avatar

Do you have some code to show where you created a session, or is this happening only fresh install without you doing anything else? Are you getting any error messages, try to give more information please. Make sure you have the latest version installed.

Cheebamba's avatar

Fresh install. Laravel 4.2 works fine, but 5.1 (installed through laravel and composer) loses session on every refresh. And no errors.

jlrdw's avatar

Check your env file / config files and look at laracasts.com/discuss/channels/laravel/sessions-are-not-persisting-between-sessions see if it helps.

kerby's avatar

Actually, it's normal secure behavior. You can check it in chrome debugbar here at laracasts.com or even laravel.com.

1

Refresh page and see result

Or if you do mean real session id get through, say, Session::getId() then you have to check config/session.php file. Probably domain or path settings could be wrong

Cheebamba's avatar

Ok, then why in my app i randomly get logged out? I log in, I refresh few times and boom - logged out. :(

Edit: Reboot somehow fixed this XD

Please or to participate in this conversation.