session variables unavailable in subdirectory

skypanther

Exalted Code Master!
I've got an app that works fine on my localhost PC but fails when uploaded here. The app includes a core library that does login checking by looking for session variables.

Pages in the site's root directory work fine--the library file is included at the top of each page, and they all successfully maintain my logged in state as I move from page to page.

But, I have a couple of pages in subdirectories. They also include() that core library. However, those files don't seem to have access to the session variables. I'm redirected to the log in, which is the expected behavior when the session variables don't exist or don't have the right values.

The site had a custom php.ini but I deleted it thinking it was the problem. That didn't change anything.

I tried explicitly setting the cookie path before starting the session using session_set_cookie_params(). The default is supposed to be "/" -- the PHP docs say Use a single slash ('/') for all paths on the domain. I manually set that anyway. Some site said I had to set a name for my sessions to get that to work. But, that had no effect either.

I've encountered this in the past with other projects and worked around it by dumping everything into the root directory. I'd rather not do that here. Can anyone help me understand why this is happening and how to get it to change?

My localhost PC is a Windows XP box running a vanilla WAMP distribution of PHP5. The site in this case is on Windows, running PHP4. I can't find any documentation that the behavior of sessions changed between versions such that I should expect this behavior. So, either my local PC is configured oddly or the site here is, or well, at least they're different.

Thanks,
Tim
 
Back
Top