php4+apache1.3+xp with sessions not working...

From: Dan Walker (dan.j.walker_at_talk21.com)
Date: 10/30/03


Date: 30 Oct 2003 13:03:22 -0800

Please help.

I seem to have a major problem with sessions on my setup. No simple
example seems to work. Example below:

page1.php:

<?php
// page1.php

session_start();

echo 'Welcome to page #1';

$_SESSION['favcolor'] = 'green';
$_SESSION['animal'] = 'cat';
$_SESSION['time'] = time();

// Works if session cookie was accepted
echo '<br />page 2';

// Or maybe pass along the session id, if needed
echo '<br />page 2';
?>

Page2.php:

<?php
// page2.php

session_start();

echo 'Welcome to page #2<br />';

echo $_SESSION['favcolor']; // green
echo $_SESSION['animal']; // cat
echo date('Y m d H:i:s', $_SESSION['time']);

// You may want to use SID here, like we did in page1.php
echo '<br />page 1';
?>
 
Output after pressing page2 link:

Welcome to page #2
1970 01 01 00:00:00
page 1

As you may be able to see, page 1 sets the date but page 2 thinks the
variable is not set and the 2 other bits, green and cat are also not
displayed. I have been told that this should work fine. Please tell me
what to look for in my setup?

Thanks
Dan



Relevant Pages