NYCPHP Meetup

NYPHP.org

[nycphp-talk] Lost Sessions

Chris Shiflett shiflett at php.net
Thu Sep 25 11:49:04 EDT 2003


--- Scott Mattocks <crisscott at netzero.com> wrote:
> Somehow the session cookie is not getting set. A new session id is 
> being created on every page load. The constant SID is available
> which means that the cookie wasn't set right. Is there a way to
> determine why the cookie isn't set? The browser is set to accept
> all cookies.

Well, there is accepting, and there is returning. It is possible that the
client is accepting the cookie just fine but for some reason is not returning
the cookie in the next request. There are several attributes that can be
associated with a cookie, and these generally restrict the cases in which a
client will send them in a request.

So, the first test might be to turn on "warnings" or whatever your browser
calls them and carefully inspect the cookie that is being set. Check things
like this:

1. Path
2. Domain
3. Expires
4. Secure

A lack of an attribute generally means a lack of the associated restriction,
except in the case of Path, which defaults to the path of the resource sending
the cookie.

You can get a more general overview of cookies here:

http://shiflett.org/books/http-developers-handbook/chapters/11

Hope that helps.

Chris

=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/



More information about the talk mailing list