PHP Session/Cookie problems with Windows XP, Vista

2019-08-23 12:12发布

问题:

I've mentioned it on here before, but still have the problem, so have added some extra info :)

We have a local intranet site that everyone on the network uses, maybe 5% (or even less) of the users that use the site have problems where the session isn't stored properly.

I've tried defining a path manually and whereas most users sessions are created and remain just fine, on the affected machines it seems that it either forgets the cookies are there, or it can't read them, and then goes on to create a new cookie almost every time you refresh a page.

Things to note are...

  • happens on both the Zend login screen and our systems, so for once it's not my dodgy code!
  • it only affects <5% of users
  • it only happens when using IE
  • it only happens with Windows XP or Vista - Windows 2000 works fine!
  • it happens to those users on any XP/Vista machine, so I can use my bosses PC and it's fine, but if he uses mine it doesn't work again...

I've tried messing with the security settings in IE too, changing the cookie security to allow all cookies/sessions, but no luck on that either unfortunately. :(

I've tried nettool but it didn't really help much unfortunately, since it just showed that the new cookies/sessions were being created, but didn't say why.

I've also tried checking the date and times are on the same on the server as they are on the workstation, and yup everything is set fine.

The name of the server is 'gc-hr01' - not sure if that should affect anything like this.

Any help would be amazing, really stuck on this.

Thanks!

回答1:

The session cookie might get refused because of insufficient validity and/or privacy information. Try to make those as specific as possible, for example:

session_set_cookie_params(0, '/path/to/your/php-application', '.www.example.com', false, true);


回答2:

I know this is an old thread, but in case anyone else happens upon this, the cause of this problem is likely the hyphen in the machine name. Apparently IE7 won't store cookies for domain names with a - or _ because they technically aren't valid. Certainly would be nice to get an error message instead of silently dropping the cookie, wouldn't it?



回答3:

Could it be that 5% of the users have user information that, when retrieved from the cookie, disrupts the proper reading/decoding/parsing of the cookie server-side?