$_SESSION not working in 4.2.3 on MS Win2000

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
goldparrot
Forum Newbie
Posts: 1
Joined: Mon Nov 18, 2002 5:50 pm

$_SESSION not working in 4.2.3 on MS Win2000

Post by goldparrot »

I am having serious troubles with using Sessions in 4.2.3 on MS Win 2000.

Is anyone else having any of the following problems?

1) When using $__SESSION, the session handling just plain doesn't work.
or
2) Same exact code written using $__SESSION works if I replace $__SESSION with $HTTP_SESSION_VARS

and
3) If I try to encapsulate the session code in a function, "wrapping it in my own class", the $HTTP_SESSION_VARS superglobal doesn't seem to be global. When I leave the function, the variable set no longer appears in $HTTP_SESSION_VARS.

Give me a shout at email bmichael@goldparrot.com if you have come across these.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

In what you've posted above you've used two underscores in $_SESSION instead of just one, so you need $_SESSION instead of $__SESSION. It could just be a typo in the post but may explain why the array doesn't appear to be working as expected.

It is also important to note that $HTTP_SESSION_VARS is not a autoglobal and has to be declared global in any function in which it is used:

Code: Select all

function myfunction($arg1, $arg2)
{
    global $HTTP_SESSION_VARS;
    /* Lots of code */
}
Mac
hedge
Forum Contributor
Posts: 234
Joined: Fri Aug 30, 2002 10:19 am
Location: Calgary, AB, Canada

Post by hedge »

I am running that exact setup without any problems. Have you checked the file security?
Post Reply