1

PHP sessions work as expected in root directory, and one directory deep. Directories that exist 2 deep end up with a new session id, and all session varaibles are lost.

I include a file config.inc.php (absolute path) into all pages which calls session_start() and initializes the SESSION variables. I found a PHP directive setting that seems to mention subdirectories, but it looks like it is referring to subdirectories of temporarily stored session files.

I've double checked using the HTTPFox firefox plugin, as soon as I visit any page 2 levels deep, the session is gone, and and a new session ID is issued. Very Strange...

Nick Pickering
  • 3,095
  • 3
  • 29
  • 50
  • 1
    session variables don't get "lost". You're probably losing the session **COOKIE**. leading to a new+empty session being created. – Marc B Aug 17 '12 at 15:57
  • That's exactly what happened. See my answer below. If we're being semantic, it would be valid to say that I lost a variable, if I defined the variable, gave it a value, and then it inexplicably becomes inaccessible. I "lost" my session variables, due to the current session cookie being overwritten. – Nick Pickering Aug 20 '12 at 02:38

1 Answers1

1

Ah, it looks like I was writing my URLS to those particular directories using localhost instead of 127.0.0.1... The different domain caused the browser to think it was a different website, I guess. Changing this solved my problem.

Nick Pickering
  • 3,095
  • 3
  • 29
  • 50