By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,040 Members | 900 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,040 IT Pros & Developers. It's quick & easy.

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

P: n/a
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 /><a href="page2.php">page 2</a>';

// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';
?>

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 /><a href="page1.php">page 1</a>';
?>

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
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
da**********@talk21.com (Dan Walker) schrieb:
I seem to have a major problem with sessions on my setup. No simple
example seems to work.


According to your subject I assume you're using Windows. Did you alter
the php.ini to set a coorect path for the seesion data?

This should be something like:

session.save_path = E:/temp

Regards,
Matthias
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.