Page 1 of 1

Weird Session Problem!

Posted: Sat Jan 29, 2005 3:57 am
by guvna69
I have this weird problem with PHP version 2.3.9. I have

Code: Select all

<?php session_start (); ?>
on my page and every time I refresh the page a new session is made. Which means refreshing 5 times produces 5 new sessions. I have tried firefox & internet explorer with session cookies enabled and it still does the same thing. I have googled and found nothing.

I am wondering if it is a PHP.ini thing. Can anyone help?

Posted: Sat Jan 29, 2005 4:22 am
by hunterhp
2.3.9? Why don't you just upgrade to version 4.3 or 5.0?

And I don't know about that far back of php, I just started.

Posted: Sat Jan 29, 2005 2:26 pm
by thegreatone2176
you could try...


if (!session_id()) {
session_start();
}

that checks if there is a session id and if there isnt it one it starts

and you really should update your php version also

Posted: Sat Jan 29, 2005 2:30 pm
by Joe
Could you show us the session variable/variables you are using!. I don't think it has anything to do with the PHP configuration file but instead something with your code.

Posted: Sat Jan 29, 2005 5:34 pm
by rehfeld
i think the php version was a typo. must be 4.x because sessions didnt exist until then.

try this. put it in a NEW php file with no other code in it.

if the session id changes everytime you refresh the page, then there is a problem

if you get any errors, please cut and paste them for us.

Code: Select all

<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);

session_start();
echo session_id();

if (!isset($_COOKIE&#1111;session_name()])) &#123;
    echo '<br> browser did not send cookie';
&#125;
?>