Sessions still do not persist
| From: | Michael R. Wayne | Date: | Fri, 21 May 2004 17:50:20 +0000 |
| Subject: | Sessions still do not persist | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-186696@lists.php.net to get a copy of this message | ||
I've posted several times mentioning that I am completely unable
to cause sessions to persist. Over the intervening time, I have
replicated this problem to a different machine, with the same
results. Here's a recap of the problem.
I am not using cookies. Sessions are automatically created (and
changing that makes no difference) The relevant session variables
(copied from phpinfo) are:
Session Support enabled
session.auto_start On <- hence no session_start
session.name PHPSESSID
session.use_cookies Off <- no cookies
session.use_trans_sid On
Environment is FreeBSD4.8. phpinfo for apache says:
Apache/1.3.29 (Unix) mod_perl/1.28 PHP/4.3.4 mod_ssl/2.8.16 OpenSSL/0.9.6d
Here is a cut/paste of the borwser screen for the code below:
Stage:0 SessionID: 04ace04b1fe0bc81d2cd678c9bab1619
_____ [Submit]
Stage:1 SessionID: 04ace04b1fe0bc81d2cd678c9bab1619 Request: Array ( )
So I type "foo" into the box and hit submit. And the session variable
is NOT preserved:
Stage:0 SessionID: 55c70989b7279d6a18edfd81b28d67a6
foo___ [Submit]
Stage:1 SessionID: 55c70989b7279d6a18edfd81b28d67a6 Request: Array ( [PHPSESSID] =>
04ace04b1fe0bc81d2cd678c9bab1619 [field] => foo )
The session directory IS writable and I see the expected information
being written there:
-rw------- 1 nobody wheel 10 May 21 13:35 sess_04ace04b1fe0bc81d2cd678c9bab1619
-rw------- 1 nobody wheel 10 May 21 13:38 sess_55c70989b7279d6a18edfd81b28d67a6
Apache runs as user "nobody" on this server. Both session files contain:
stage|i:1;
but the files never seem to be being read back!
Help!?
Here's the entire php code I'm testing with:
<?
if (!isset($_SESSION['stage'])) {
$_SESSION['stage'] = 0;
}
if (!isset($_POST['field'])) { $_POST['field'] = ""; }
?>
<html>
<head><title>PHP Test page</title></head>
<body>
<?
echo "Stage:"; echo $_SESSION['stage'];
echo " SessionID: "; echo session_id();
$_SESSION['stage'] = 1;
?>
<form method="post" action="xxx.php">
<input type="text" maxlength="7" size="7"
name="field" value="<?echo $_POST['field']?>">
<input type="submit" value="Submit">
</form>
<?
echo "Stage:"; echo $_SESSION['stage']; echo " ";
echo " SessionID: "; echo session_id(); echo " ";
echo " Request: "; print_r($_REQUEST);
?>
</body> </html>