PHP sessions stopped working
Posted by: coolgeek
Posted on: 2006-02-01 16:37:00
(I logged a support request (with username/password), but figured I'd check here too)
Both my production and dev sites use PHP session management to keep track of usernmae/id/etc. Sometime within the last two weeks, session management broke (fortunately, my prod site is currently relatively inactive - it's in a public beta, while I await a edveloper performing an interface redesign). Nevertheless, the problem is occurring on both sites.
In analyzing the problem on my dev site, using the following code snippet:
<pre><?php print_r($_SESSION); ?></pre>
I can see the session vars on the login page, upon logging in:
Array
(
[username] => gleep
[last_visit] => 2006-02-01 15:51:49
[user_type] => 600
[user_id] => 2
)
but as soon as I go to any other page, all session vars disappear:
Array
(
)
This particular empty array display comes from the "Home" (index.php), which is the only page that I've applied the snippet to besides the login page. However, it doesn't matter what page you go to after logging in, the problem recurs. (You can tell because the side bar menu reverts from "You are logged in as" to "Login")
You can log into the dev site -
http://coolgeek.dreamhosters.com/index.php and see the problem for yourself.
A note on site architecture: all pages call templates/header.inc and templates/footer.inc. The first lines of header.inc are:
<?php
session_name ('HAVisitID');
session_start(); // Start the session.
?>
The last code change on the site occurred on 1/16. The last time that I can be CERTAIN that I logged in and successfully performed work through the site is 1/17. As such, I can be reasonably certain that the problem does not lie with a code change on my part.
Were there any PHP upgrades/patches, Linux patches to Yoda, etc?
What else could be causing this problem?