RE: [PHP] session data missing
| From: | Johnson, Kirk | Date: | Wed, 09 Jul 2003 15:06:45 +0000 |
| Subject: | RE: [PHP] session data missing | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-154567@lists.php.net to get a copy of this message | ||
> After creating a new session with session_start() and
> inserting a few values
> e.g $HTTP_SESSION_VARS['foo'] = 'bar'; a file
> /tmp/sess_{session_id} is
> created.
> The problem is that this file is empty! 0 bytes. no data is stored.
> I'm using php 4.0.6 on linux with apache 1.3 something.
Check the register_globals setting in php.ini. If it is set to "On", then
code like this:
session_start();
$foo = 'bar';
session_register('foo');
echo $foo;
If register_globals is set to "Off", then code as you are already doing:
session_start();
$HTTP_SESSION_VARS['foo'] = 'bar';
echo {$HTTP_SESSION_VARS['foo']};
Kirk