I have a website with a php log in. Everytime a page is visited, I call on session_start()
.
I've been having this unusual problem where 1 in 5 times (or so), my session_start will fail to recognize the existing PHPSESSID
cookie and instead creates a new one, so that I have 2 of them, and stops using all of the data stored in the first session.
It goes as such: I log in successfully, and am successfully redirected to the same page I was on but now logged in, and I am assigned a session id cookie, and the session successfully stores its data (all checked and confirmed)
Then I click any link on the page (even the link that takes me to the same page I'm on) and instead of continuing the session, it creates a new session, giving me a second session cookie and effectively logging me out.
This only happens 1 in 5 times, and only when I first visit the website. On successful trials, when I log in, navigating to another page leaves me with 1 session id cookie instead of 2.
I've been banging my head on the wall with this problem, and would love any help!