Login fails silently, seems to be a session problem

Interesting! I wrote and executed a script that called session_start() without issue. Then I tried logging in, and it worked! This made me terribly suspicious, so I tried logging out again, which recreated the problem.

In other words, you seem to be correct that session_start is either not being called or failing when MODX calls it.

anonymous_sessions was set to 0 (false) so I changed it to 1 and cleared the cache. Doing this fixed the log in issues, and I can imagine why. I can now log in and logout and even clear my cookies without this issue recurring.

However, I expect that breaking login is an unintended consequence of turning off anonymous sessions. Shouldn’t the login page still generate a session? I prefer to have sessions off for the main site.

Thinking that this might be a bug, I tested on a clean install (at the same host) and it created the same log in issue. As far as I can tell, the only thing necessary to create this problem is changing the system setting anonymous_sessions to No.

While this might be a bug with anonymous_sessions or unique to my host, my particular issue has definitely been solved :confetti_ball: Thank you @halftrainedharry for your succinct and prompt troubleshooting assistance!

For anyone with the same issue: As a workaround to keep session cookies off the main site I set session_enabled to No for the web context which worked nicely, setting anonymous_sessions to No for web worked as well. I found the workaround on this closed issue from modx 2.5.

These were the issues that resembled my problem, both closed:

1 Like