为了账号安全,请及时绑定邮箱和手机立即绑定

IIS7,IIS7.5在高版本IE下丢失session,每次刷新页面,都会生成新的sessionID

IIS7,IIS7.5在高版本IE下丢失session,每次刷新页面,都会生成新的sessionID

GCT1015 2019-04-07 09:38:33
测试脚本为php,IE版本为ie9,其它内核浏览器ff,chrome,safari下都没有这个问题。发现这个问题的时候,是做了一个登录页,使用$_SESSION来判断,ie就是登不上去,其它浏览器没问题。后来测试了一下printsession_id();ie下每次刷新页面的值都不一样,打开d:\tmp\session(这是php.ini里面设置的session存储位置),每次刷新增加一个session文件,当然这在其它浏览器下也不存在。后来嘛,临时做了个解决方案,就是在php页面里设置一个cookiesession_start();setcookie('PHPSESSID',session_id());算是临时解决了,但是……蛋还是继续的疼下去了,服务器(win2008x86iis7fastcgiphp5.2.17nts)上放了一个drupal,经常有人反应登陆不了,不用猜,肯定是用IE登不上,这事烦恼的我啊,我可不想去改drupal...反正几个月以来,都在找答案。现在,答案已经没那么重要了,只希望有解决办法,请各位走过路过的朋友们,给点您的经验,帮帮我这迷途的羔羊。。顺便提一下,在寻找答案的路上,找到了一个和我一样问题的人,但是解决方案我没搞明白,因为可以肯定的是,我的域名没有下划线。。http://forums.iis.net/t/1150171.aspx请看得明白这个帖子的朋友,也给指点一下。附上抓包数据(隐去了域名):IE下:GET/index.phpHTTP/1.1Accept:text/html,application/xhtml+xml,*/*Accept-Language:zh-CNUser-Agent:Mozilla/5.0(compatible;MSIE9.0;WindowsNT6.1;Trident/5.0)Accept-Encoding:gzip,deflateHost:***.***.cnConnection:Keep-AliveCookie:has_js=1HTTP/1.1200OKCache-Control:public,max-age=600Content-Type:text/html;charset=utf-8Content-Language:zh-hansExpires:Sun,19Nov197805:00:00GMTLast-Modified:Mon,12Aug201305:54:19+0000ETag:"1376286859-0"Vary:CookieServer:Microsoft-IIS/7.0X-Powered-By:PHP/5.2.17X-Drupal-Cache:MISSX-Generator:Drupal7(http://drupal.org)X-Powered-By:ASP.NETDate:Mon,12Aug201305:54:37GMTConnection:keep-aliveContent-Length:9829POST/?q=front-page&destination=front-pageHTTP/1.1Accept:text/html,application/xhtml+xml,*/*Referer:http://***.***.cn/index.phpAccept-Language:zh-CNUser-Agent:Mozilla/5.0(compatible;MSIE9.0;WindowsNT6.1;Trident/5.0)Content-Type:application/x-www-form-urlencodedAccept-Encoding:gzip,deflateHost:***.***.cnContent-Length:129Connection:Keep-AliveCache-Control:no-cacheCookie:has_js=1HTTP/1.1302RedirectCache-Control:no-cache,must-revalidate,post-check=0,pre-check=0Content-Type:text/html;charset=UTF-8Expires:Sun,19Nov197805:00:00GMTLast-Modified:Mon,12Aug201306:02:32+0000ETag:"1376287352"Location:http://***.***.cn/?q=front-pageServer:Microsoft-IIS/7.0X-Powered-By:PHP/5.2.17X-Drupal-Cache:MISSSet-Cookie:SESS6a2ee0acf5e5bd0d9cea678a1bb7540f=S2CFFREDq47DBALxDLxlCVzhqnI98MMm4yHPY_k7dho;expires=Wed,04-Sep-201309:35:57GMT;path=D:/tmp/cook;domain=.***.***.cn;HttpOnlyX-Powered-By:ASP.NETDate:Mon,12Aug201306:02:37GMTConnection:keep-aliveContent-Length:155firefox下:GET/index.phpHTTP/1.1Host:***.***.cnUser-Agent:Mozilla/5.0(WindowsNT6.1;rv:22.0)Gecko/20100101Firefox/22.0Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language:zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3Accept-Encoding:gzip,deflateCookie:Drupal.toolbar.collapsed=0;has_js=1Connection:keep-aliveIf-Modified-Since:Mon,12Aug201305:56:10+0000If-None-Match:"1376286970"HTTP/1.1200OKCache-Control:no-cache,must-revalidate,post-check=0,pre-check=0Content-Type:text/html;charset=utf-8Content-Language:zh-hansExpires:Sun,19Nov197805:00:00GMTLast-Modified:Mon,12Aug201305:56:51+0000ETag:"1376287011"Server:Microsoft-IIS/7.0X-Powered-By:PHP/5.2.17X-Generator:Drupal7(http://drupal.org)X-Powered-By:ASP.NETDate:Mon,12Aug201305:56:56GMTConnection:keep-aliveContent-Length:18842POST/?q=front-page&destination=front-pageHTTP/1.1Host:***.***.cnUser-Agent:Mozilla/5.0(WindowsNT6.1;rv:22.0)Gecko/20100101Firefox/22.0Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language:zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3Accept-Encoding:gzip,deflateReferer:http://***.***.cn/Cookie:Drupal.toolbar.collapsed=0;has_js=1Connection:keep-aliveContent-Type:application/x-www-form-urlencodedContent-Length:129HTTP/1.1302RedirectCache-Control:no-cache,must-revalidate,post-check=0,pre-check=0Content-Type:text/html;charset=UTF-8Expires:Sun,19Nov197805:00:00GMTLast-Modified:Mon,12Aug201305:59:42+0000ETag:"1376287182"Location:http://***.***.cn/?q=front-pageServer:Microsoft-IIS/7.0X-Powered-By:PHP/5.2.17X-Drupal-Cache:MISSSet-Cookie:SESS6a2ee0acf5e5bd0d9cea678a1bb7540f=DjNRVBdGXEVPumZnszKG9U8bAP0dHqx5wp8jFhJV81U;expires=Wed,04-Sep-201309:33:07GMT;path=D:/tmp/cook;domain=.***.***.cn;HttpOnlyX-Powered-By:ASP.NETDate:Mon,12Aug201305:59:47GMTConnection:keep-aliveContent-Length:155
查看完整描述

2 回答

?
largeQ

TA贡献2039条经验 获得超8个赞

自己给自己结贴,终于发现问题出在哪里了,这真的是我的错。
因为我把php.ini里面的一个变量:session.cookie_path的意思理解错了,填成d:\tmp,所以大家都没法登陆进去。现在改成空,已经正常了。
                            
查看完整回答
反对 回复 2019-04-07
?
料青山看我应如是

TA贡献1772条经验 获得超8个赞

补充一下:
session.cookie_path是指session生效的网站域;
session.save_path是指存储session临时文件的路径。
                            
查看完整回答
反对 回复 2019-04-07
  • 2 回答
  • 0 关注
  • 747 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号