What is the distinct difference between session_id($randomString) and session_regenerate_id()? Both seem to change session id:
The session_id function will just change the session id and update the session cookie on the client.
The session_regenerate_id function will act like the session_id one with the additional session migration on the server.
In fact as you can read from the docs of the session_id function, it needs to be called before the session_start function, otherwise it may be lay you to a session loss.
Example:
Conditions:
Description:
/tmp/sess_1234abc./tmp/sess_SESSID in this case /tmp/sess_1234abc)session_id function/tmp/sess_MyTestSession file but the session has not been changed by the session_id function so is still /tmp/sess_1234abc!So if you want to prevent session fixation the way to go is definitely session_regenerate_id