Support the ongoing development of Laravel.io →
posted 3 years ago
Session

Hi,

I have a login program (PHP) that writes sessions after a successful login and then the user is redirected to a Laravel program. The SESSIONs should then be read out in this Laravel programme.

Unfortunately I get a message that the $_SESSION is not defined.

Do you have a tip for me?

Last updated 2 years ago.
0
moderator Solution

Laravel doesn't use the native session handler from PHP.

The most clean way is to write a custom session driver see: https://laravel.com/docs/8.x/session#adding-custom-session-drivers
And / or search on packagist for a good package that does that for you: https://packagist.org/?query=laravel%20session

Another fast but less maintainable option is to add session_start() to your Laravel application and use the $_SESSION global variable directly.

veritexx liked this reply

1
Solution selected by @driesvints

Thanks for your tip 👍

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Veritexx veritexx Joined 19 Jan 2020

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.