admin管理员组文章数量:1122846
We have a questionnaire with a product configurator and we are saving the configuration for the user with a session. Somehow the session is not working properly. For some users it's just not saving the session and the user can't see his final configuration. Rather get's in a loop, where he needs to start the questionnaire again. This does not seem browser related.
We use session_id() in PHP to get the session ID. We checked some users randomly and it's not always working properly. Usually removing the session folder solves this issue and it works again. But well this can't be the solution, since everybody elses session gets deleted.
It's difficult to track the issue, since it's not easy to recreate. But what we saw is, that this issue seems to occur, when we upload some changes to the website or theme. Could be an coincidence though. My feeling was, if somebody already had a session saved and we uploaded some changes, that the session is deleted and it's not saving again. But like I said, we could not recreate this.
We are using:
- WP + WooCommerce
- Custom Plugin for Questionnaire
- AWS Server (Cloudways)
- Cloudflare
Any ideas are appreciated!
We have a questionnaire with a product configurator and we are saving the configuration for the user with a session. Somehow the session is not working properly. For some users it's just not saving the session and the user can't see his final configuration. Rather get's in a loop, where he needs to start the questionnaire again. This does not seem browser related.
We use session_id() in PHP to get the session ID. We checked some users randomly and it's not always working properly. Usually removing the session folder solves this issue and it works again. But well this can't be the solution, since everybody elses session gets deleted.
It's difficult to track the issue, since it's not easy to recreate. But what we saw is, that this issue seems to occur, when we upload some changes to the website or theme. Could be an coincidence though. My feeling was, if somebody already had a session saved and we uploaded some changes, that the session is deleted and it's not saving again. But like I said, we could not recreate this.
We are using:
- WP + WooCommerce
- Custom Plugin for Questionnaire
- AWS Server (Cloudways)
- Cloudflare
Any ideas are appreciated!
Share Improve this question asked Feb 24, 2021 at 8:56 AnilAnil 11 bronze badge 1- WordPress doesn't use PHP sessions, and a lot of WP hosts don't work with PHP sessions. Likewise PHP sessions rely on a browser cookie that stores a session ID, and in an in memory data store to hold the session values. If your server environment isn't persistent e.g. a lambda server, relies on caching and CDNs, then it's highly unlikely your PHP sessions will ever work. have you considered using cookies instead? PHP Sessions need a cookie to be set to work so it can't be used to bypass GDPR, trackers policies, and cookie prompts – Tom J Nowell ♦ Commented Feb 24, 2021 at 9:40
1 Answer
Reset to default 0Any caching solution will probably break sessions.
Try turning off all caching (as well as CloudFlare proxy for your IP address) and see if your code works. If you have a WordPress caching plugin - turn that off too. If your hosting provider does some caching - turn that off too.
After turning off all caching if your site works, then you'll have to either 1) find another solution not using PHP sessions (recommended), or 2) make sure you never cache your pages (not recommended).
本文标签: Session is not working properly
版权声明:本文标题:Session is not working properly 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736292521a1928951.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论