开发者

Session is not maintained when page gets redirected in my localhost

开发者 https://www.devze.com 2023-01-04 00:17 出处:网络
Session is not maintained when page gets redirected to another in my localhost, I开发者_如何学JAVA have a admin login page of my osCommerce v2.0 site, whenever i login its the session registered in lo

Session is not maintained when page gets redirected to another in my localhost, I开发者_如何学JAVA 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?


There is a php.ini setting called session.auto_start, more than likely that is set on your main server.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号