1

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.

  • Maybe https://stackoverflow.com/a/36061324/2310830 – RiggsFolly May 08 '20 at 15:57
  • DId you check `session.cookie_lifetime` – RiggsFolly May 08 '20 at 15:58
  • Might help https://stackoverflow.com/questions/2045550/php-session-id-changes-between-pages – RiggsFolly May 08 '20 at 15:59
  • @RiggsFolly Thank you. 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. – shadow flsh May 08 '20 at 16:37
  • This all seems to be config oriented, So basically the servers are not configured the same. – RiggsFolly May 08 '20 at 16:38
  • session_save_path is also configured in `php.ini` – RiggsFolly May 08 '20 at 16:39
  • Okay, just one more question,can I configure different session_save_path in php.ini for different sites? – shadow flsh May 09 '20 at 01:15

0 Answers0