[thelist] PHP session problems??

Liz Lawson lizlawson at charitycards.co.uk
Mon Feb 26 05:28:35 CST 2001


yup, or at least similar. At some points in our site, PHP was not
recognising the current session and initiating another. If you returned to a
previous point in the site, you had your old session back. If you went back
to the bad area again, you were back into the newer session.

In our case it was because the path for the session cookies (in php.ini)
wasn't set to the site root so the cookies were defaulting to being specific
to the directory in which they were set. As we are on a shared server we
couldn't change the cookie path, and ended up restructuring the site so that
all the pages were on the top level. :-(

My guess is that your cookies are being set with a different domain to the
one you think, maybe your ip number (or if you're running this locally, your
network machine name or localhost) rather than mydomain.com. When you are
using <a href=page2.php> links, the cookie is returned but the browser sees
<a href=http://mydomain.com/page2.php> as a different domain so no cookie.
Try echoing out $PHP_SELF on pages which work and pages which don't, or if
you can set apache to log cookie data and see exactly what is being returned
for each request.

HTH

Liz



>I can't figure out why I am able to link to a page in my site by <a
href=page2.php>
>and session variables are recognized, but if I link to <a
>href=http://mydomain.com/page2.php> then my session variables are not
recognized
>and I have to relogin.
>
>Anyone ever had this problem???







More information about the thelist mailing list