RE: [PHP] problem reading sessions
| From: | Johnson, Kirk | Date: | Fri, 04 Jan 2002 20:56:32 +0000 |
| Subject: | RE: [PHP] problem reading sessions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-79493@lists.php.net to get a copy of this message | ||
Is register_globals set to 'on' in php.ini? It needs to be for this coding
style to work.
Kirk
> -----Original Message-----
> From: Alastair [mailto:alastair@uoguelph.ca]
> Sent: Friday, January 04, 2002 1:41 PM
> To: php-general@lists.php.net
> Subject: [PHP] problem reading sessions
>
>
>
> I have just recently set up PHP on my Win2K laptop and I have
> just found out
> that I can't read sessions. As far as I can tell the session
> file is being
> created, but PHP doesn't seem to be able to get any data into it.
>
> Here is what the session file looks like:
> !sess_user|!blah|
>
> The two PHP files look like this:
>
> test_session1.php
> <?
> $blah = "good";
> session_start();
> session_register("blah");
> ?>
>
>
> test_session2.php
> <?
> session_start();
> echo session_is_registered("blah") . "<br>";
> echo session_encode(). "<br>";
> echo isset($HTTP_SESSION_VARS) . "<br>";
> echo sizeof($HTTP_SESSION_VARS) . "<br>";
>
> echo $blah;
> ?>
>
> For the second PHP page the ouput I get is:
> - true for the 'session is registered' function
> - the string that is found in the session file (listed above)
> - true for the 'isset' function
> - size of zero
> - The warning: 'Warning: Undefined variable: blah '
>
> Does anybody know why I would not be able to read these variables?
>
> thanks,
> alastair