weird session problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Dedix
Forum Newbie
Posts: 8
Joined: Mon Feb 24, 2003 12:13 pm

weird session problems

Post by Dedix »

Hi there guys!

I'm trying to use this little sample script (in two ways) on my server but it doesn't want to work. My question is very simple: Why?:-)

Here is the one:

Code: Select all

<?php

// index.php

session_start();
$my_session_variable = "some value";
session_register("my_session_variable");

print "<a href=index2.php>Click me</a>";

?>


<?php

//index2.php

session_start();
print "Value of 'my_session_variable': $my_session_variable";

?>
And the other:

Code: Select all

<?php

// index.php

session_start();
$_SESSION&#1111;'my_session_variable']="some value";

print "<a href=index2.php>Click me</a>";

?>


<?php

//index2.php

session_start();
print "Value of 'my_session_variable':".$_SESSION&#1111;'my_session_variable'];

?>

I took a look into session save path, the session file was created well and contains the correct data:

my_session_variable|s:10:"some value";

I also have tried call the script above this way:

index2.php?PHPSESSID=sessionid

or setting session.use_trans_sid to 1
and in both cases it worked fine, but if i call this file without the sessid string it doesn't work...
So, what should i do to get session based scripts work having the setting above disabled and not using sessid string in url?

Here are a few settings from my php.ini file:
(but i have tried to change these from 1 to 0)

session.use_cookies = 1
session.use_only_cookies = 1


BTW, my configuration is: Win XP, PHP v 4.3.1, Apache v 1.3.27.



Any help would be greatly appreciated!
Dedix
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Have you got cookies disabled on your browser?

Mac
Dedix
Forum Newbie
Posts: 8
Joined: Mon Feb 24, 2003 12:13 pm

Post by Dedix »

twigletmac wrote:Have you got cookies disabled on your browser

I have got them enabled.
Post Reply