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

lifesound's avatar

Does the session deleted automatically by the end of the request ?

I am afraid that using the default memory session could create any bottleneck, i am not thinking of Redis But thinking of DB session ... so I have a couple of questions? 1- Does the session for the request be deleted automatically by the end of the request ? 2-What are the disadvantages of using DB as a session store other than performance ?

0 likes
4 replies
jlrdw's avatar
jlrdw
Best Answer
Level 75

No, unless a flash session. A session is what holds Authentication.

Flash is if you need to display a message or something then it's deleted.

But you can delete some session Keys no longer needed if you need to.

I suggest reading the chapter on sessions.

1 like
martinbean's avatar

@lifesound What good would a session being deleted at the end of a request be? You’d be logged out immediately after logging in if the session was trashed at the end of the login request.

A session is meant to persist across requests.

1 like
Snapey's avatar

The default session handler is database

Please or to participate in this conversation.