NYCPHP Meetup

NYPHP.org

$_SESSION

Sexton, David dsexton at ubspw.com
Thu May 8 16:07:40 EDT 2003


I'm hoping someone can help me with this... I am running PHP 4.1.2 on
WINNT4.0 in CGI mode.
 
All I'm trying to do (as a test), is write data to a session object using
the $_SESSION superglobal, like so:
 
<?php
session_register('test_var');
$_SESSION['test_var'] = "Hello World";
PRINT $_SESSION['test_var'];
?>
 
The variable 'test_var' registers, but the value 'Hello World' does not get
written. What's even more confusing is that the script prints 'Hello World'
to the screen. It seems like PHP is interpreting $_SESSION['test_var'] as a
custom built associative array, since it is printing the value but not
storing it in the session file.
 
Some folks suggested it may be a compatibility issue between $_SESSION and
register_globals = On - So I turned them off and it still doesn't work.
 
The session files are writable if I use the registered globals, but that is
both insecure and a pain because I have to pay attention to scope within
functions.
 
Anybody have any suggestions on what the problem could be?
 
Thanks.



More information about the talk mailing list