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

striker's avatar

session management laravel 5

what is the difference between 'driver' => env('SESSION_DRIVER', 'file') and 'driver' => env('SESSION_DRIVER', 'cookie') in laravel 5 .

Because if i change file to cookie in config/session.php i can still see session file in storage/framework/session folder

0 likes
3 replies
tangoG's avatar

because you must have set SESSION_DRIVER=file in your .env file . Change it to

 SESSION_DRIVER=cookie

and delete the previous session file in the storage.

striker's avatar

So what you are trying to say is that if i need cookies instead of file i have to make changes in both places: 1 - config/session.php 2 - .env

tangoG's avatar

No you just need to change it in .env file .

env('SESSION_DRIVER', 'file') 

means that laravel will pick the SESSION_DRIVER if it is present in .env , if it isn't there it will use the default value which is the second parameter .

Please or to participate in this conversation.