Categories
PHP Tips & Tutorials

PHP: Session ID changes automatically at every request / page load

Ideally the initial session id will remain the same throughout a session unless the developer has explicitly asked PHP to change it by the session_regenerate_id() function or the session_id() function. However, there’s a slight chance that you may encounter this problem of automatic changing session ID upon every new request when you are developing things up, such as, on a localhost. You may be mad at PHP cause’ this way you won’t be able to use session id to track things out (which may be seldom, but still).

So what’s the problem?

You have set the browser to reject all cookie. You don’t know browsers track sessions via cookie?! HTTP is stateless, dumbass!

By Yang Yang

Hello, I'm Yang. I build online businesses that please people. Want to join in and post some useful articles on Kavoir.com? Shoot me a message.