I found that session_start()
changed the PHPSESSID
in the cookie, because without it, the PHPSESSID
in the cookie will not change.
But the expected result should be that after refreshing the page, session_start ()
will not change the PHPSESSID
in the cookie and I got the correct result when deploying the same code file to another server.
Another point that confuses me is that in the server in question, the value of PHPSESSID
in the set-cookie value of the response header every time the page is refreshed is an unchanged, correct value.
I find that if I set session.auto_start = 1
then the problem is solved.However,I need to call session_save_path()
before session_start()
so that sessions won't be saved in the tmp directory.I don't know why when I call session_start ()
manually, the error occurs on this server, but it works fine on other servers.