For my website, session management mostly works ok. Sessions are created, saved and used later without problems.
But when the code is using session_start(), it alway
This is not exactly about the original cause, but the resolution is exactly same: new session ids gets defined with each reload.
In this case, fault was Varnish, which was set to put every request to pass mode (return (pass)
) instead of caching everything. As consequence, every request made it to the backend, where session_start() was called every time.
But when the response was sent through Varnish to the client, cookies were removed from the response. This is due that backend sets cookies (session id, along with others) even when we want to have the site be cached. Anyway, cookies get removed, client does another request and does not pass any cookies (it never received any!) and there PHP goes again calling session_start() without any session id present...
This is more of fault in recognization of error in this case, which appeared as multitude of unnecessary sessions created. Those would’ve not been created in first place if caching was enabled in first place.
There is also another way to manage to create these sessions: have browser not to accept cookies at all. Stupid reason, I know, but it does happen...
For the original problem, I haven’t stumbled it since moving from original development machine away.