Forum Moderators: coopster

Message Too Old, No Replies

Xampp on local host no keep session variables

xampp losing session variables on local host

         

ronnieb

8:23 pm on May 13, 2009 (gmt 0)

10+ Year Member



Hey guys, I am running Xampp on Windows XP (for a long time) and recently it quite carry over session variable information from page to page.

example. I can login to Index.php (via $_POST) and then when I try to navigate to the next page via hyperlink (all in the same tree/domain) it's as if I never logged in and all $_SESSION varialbes are gone.

any one seen this before?

henry0

8:52 pm on May 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How are (after login using $_POST) created and carried your login sessions

Have you tried to simply create a couple of pages and test how sessions are passed?

ronnieb

9:01 pm on May 13, 2009 (gmt 0)

10+ Year Member



On my page I print_r($_SESSION) when it's on the localhost, and it usually carries everything over... up until recently. I start each page with

<?php
session_start();

It's almost like my pages don't have the session_start(); at the top?

henry0

9:17 pm on May 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here is from the manual what does print_r()
print_r() displays information about a variable in a way that's readable by humans.

Why do not you use something like the following:
The very first page where the form submit lands
has for example $username=$_POST['username'];
then to carry it all over the place you need to build a session
$_SESSION['username']=$username;
$username=$_SESSION['username'];

then on all pages have
$username=$_SESSION['username'];

unless I misunderstood your answer and you were just showing how to verify the session content!
but if that is the case you still did not show how you created the sessions

ronnieb

9:26 pm on May 13, 2009 (gmt 0)

10+ Year Member



Ok, that's similar to how I have it.

Basically

$SESSION['user']=$_POST['user'];

It's not my script, the script works on the server just fine. I think it has something to do with my localhost. I can upload all pages to my server (with godaddy) and it works great, but when I run it on my local host with XAMPP it won't carry the session variables from page to page.

I was wondering if someone had seen this before with XAMPP, maybe a Microsoft Upgrade messed something up?

ronnieb

9:28 pm on May 13, 2009 (gmt 0)

10+ Year Member



I meant Microsoft patch and not upgrade.

ronnieb

9:39 pm on May 13, 2009 (gmt 0)

10+ Year Member



it's very wierd. I can login on my login.php page, and the last thing the script does is:

print_r($_SESSION);
?>

and then you see that all session variables are good, but you can even go up to the address bar and click the same URL and it's like you never logged in. It's like you never started a session.

henry0

9:49 pm on May 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try adding after session_start();
error_reporting(E_ALL);
and let us know if anything shows

Are you sure that session path is fine in your php.ini

try also to stop and restart Apache

ronnieb

5:40 am on May 14, 2009 (gmt 0)

10+ Year Member



I messed with a few other pages and the sessions variables worked fine. I must have some coding errors somewhere. I will have to mess with it a bit and then check back in.