Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts

    php not sending $_SESSION over pages on localhost

    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 Code:
    <?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:
    Code:
    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.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    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!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •