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

davorminchorov's avatar

How can I increase the session lifetime for unauthenticated users (guests) when they browse a website?

Hello!

I am looking for a way to increase the lifetime of the session based on the clause if the user is authenticated or not. I am keeping some data in the session for tracking purposes and I want it to be longer than 2 hours.

I know about the session_lifetime option in the config files but that won't help because in this case, that number should be dynamic.

Any ideas how can I do that dynamically in runtime?

0 likes
0 replies

Please or to participate in this conversation.