当页面在我的本地主机中重定向时,会话不被维护
当页面重定向到本地主机中的另一个页面时,会话不会被维护, 我的 osCommerce v2.0 网站有一个管理员登录页面,每当我登录时,在索引页面中找不到在登录页面中注册的会话,因此重定向回登录页面... 请指导我为什么这种情况发生在我的本地主机而不是我的服务器中?
Session is not maintained when page gets redirected to another in my localhost,
I have a admin login page of my osCommerce v2.0 site, whenever i login its the session registered in login page is not found in index page hence redirected back to login page...
Please guide me why this happening in my localhost and not in my server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有一个名为 会话的 php.ini 设置。 auto_start,很可能是在您的主服务器上设置的。
There is a php.ini setting called session.auto_start, more than likely that is set on your main server.
问题可能是浏览器未发送回 cookie,“localhost”过去曾给我带来过此问题。这与您在域名中没有规范 IIRC 所要求的句点有关(显然您在真实服务器中这样做,这就是它在那里工作的原因)。
打开
c:\windows\system32\drivers\etc\hosts
并添加别名:127.0.0.1 server.local
根据需要更改您的 osCommerce 配置,然后再次尝试访问该页面通过 server.local 看看会发生什么。
The issue may be with the cookies not being sent back by the browser, "localhost" has caused me problems with this in the past. This is something to do with the fact that you don't have a period in the domain name which is required by the spec IIRC (you obviously do in the real server which is why it works there).
Open
c:\windows\system32\drivers\etc\hosts
and add an alias:127.0.0.1 server.local
Alter your osCommerce config as necessary and try accessing the page again via server.local and see what happens.
我发现将 localhost 更改为 127.0.0.1 可以维持会话,并在 Windows 8.1 平板电脑上运行的 WAMP 上修复此问题。
然后,您只需更新管理和目录中的configure.php文件,即可将所有对localhost的引用更改为127.0.0.1
I found that changing localhost to 127.0.0.1 allowed the session to be maintained and fixed this issue on WAMP running on a Windows 8.1 tablet.
You then simply need to update the configure.php files in both admin and catalog to change all references to localhost to 127.0.0.1