CLIENT:
start_session() creates a cookie (by default): Name: PHPSESSID; Content: 1q2w3e4r5t; Domain: '/'; Expires:...
SERVER:
It also creates a file stored in (my case): /var/lib/php/sessions. Call that in there: sess_1q2w3e4r5t. (Absolute path: /var/lib/php/sessions/sess_1q2w3e4r5t)
So we have two physical things that are bonded to the session I just created.
What is the point of having both?
Can I just store my session in
/var/lib/php/sessionsregardless ofuse_only_cookiesoption?I have a classic example with a
$_SESSION['counter']variable. Meaning that, every time I reload theexample.phppage, the$_SESSION['counter']increments (++) by one. So, on the loop of pressing theF5button, lets say I got55as the value of$_SESSION['counter']. Finally I its that cookie but not the/var/lib...file. After that deletion I get a56and the loop continues as normal. This just intrigued me and got me with the question. Are session cookies necessary?Is still possible a way in which my site just stores session only in the server and not using cookies?
This is how I deleted the cookie. notice counter value is 69.
Then F5:

