PHP Session ID changing on every request

I just had and solved the exact same problem.

It turns out that the cookie PHPSESSID (that keeps record of the session) was been send but it was ignored by the server, so the session was not maintained and the server restarted the session every time the page reloads or changes.

The problem was that I had in my wp-config.php this line:

@ini_set('session.cookie_secure','On');

This means that if the connection is not secure, every cookies is to be ignored, therefore the server the PHPSESSID cookie and the session was restarted.

Check your wp-config.php or your init.php. Is a problem with cookies.

Leave a Comment