...

View Full Version : php not sending $_SESSION over pages on localhost



Fou-Lu
05-29-2004, 10:31 PM
I'm using Apache 1.3.29 with PHP 4.3.6 on my PC in order to test my scripts before I upload. I cannot get php sessions to work correctly, or at least I don't think they are.


<?php
session_start();
header("Cache-Content: private");
$_SESSION['username'] = "Bob";

?>
Welcome <?php echo $_SESSION['username']?>! Click <a href="page2.php?<?php echo "s=session_id()" ?>">here</a> to proceed to the next page!


Well, thats an annyoing example to look at, but essentially I've got the username set from a log in script which is accessed from the database. Even if I use print_r($_SESSION) and can see that the username is set as well as if I check the session_id to confirm that its the same in the a href, it still won't send the session over the page. In fact, if I just refresh the page, it will automatically make a new session for it. All I end up with is a whole crap load of session files on my computer from going back and forth a few times.
I have php configured like so:


session.save_handler = files
session.save_path = "C:\WINDOWS\PHP_SESSIONS";
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php

Any idea why it always makes a new session and will not pass along other pages? Is it supposed to do that? If you need any more info, just ask.

Fou-Lu
05-29-2004, 10:42 PM
Sorry, just put it to the test and its working fine now. Methinks it was just needed a restart before, but it appears that I have no problems now!

Thanx anyway for the help if you would have considered it!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum