Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP session variables gone when clearing cookies

I have been doing a lot of research on the internet with regards to sessions and cookies and the argument for sessions that I keep coming across is that if cookies are disable it won't affect the sessions.

Still, every time a clear cookies my session variables seem to clear as well. Also, I've read on a few websites that sessions should in fact clear with the cookies.

Can someone please explain this to me?

like image 460
aelsheikh Avatar asked Aug 03 '26 06:08

aelsheikh


1 Answers

If its possible php stores its session id in a cookie. If your browser rejects that, it carries the session id along with the query string.

If you kill your cookies and no query string adjustment was made, php forgets who you are!

However cookie usage can be disabled by https://www.php.net/manual/en/session.configuration.php#ini.session.use-cookies

like image 87
worenga Avatar answered Aug 05 '26 19:08

worenga