Session variables getting over-written

Session variables getting over-written

Posted by: cedric
Posted on: 2006-08-07 19:34:00

I'm running PHP4 (as CGI) and have recently noticed a problem with my session variables that wasn't there a week ago. I've got a bunch of data stored in session (eg. $_SESSION['stuff']) and noticed that any PHP code that sets a variable with the same name as the index (eg. $stuff) is wiping-out the session variable. Does anyone know if there is a PHP setting that is causing this (like register_globals)? I've tried changing several PHP settings using the ini_set method without any luck. Could there have been a change in the PHP4 set-up on DreamHost that might have caused this to start happening? Any help or suggestions would be very appreciated.

Re: Session variables getting over-written

Posted by: Atropos7
Posted on: 2006-08-07 19:52:00

Without doing the init_set call, try making a page that calls php_info to see what the settings are.



cool Atropos | openvein.org

Re: Session variables getting over-written

Posted by: cedric
Posted on: 2006-08-07 19:54:00

Can do. Got it here...
http://admin.freezerbox.com/phpinfo.php

Re: Session variables getting over-written

Posted by: Atropos7
Posted on: 2006-08-07 21:01:00

In reply to:

I'm running PHP4 (as CGI) and have recently noticed a problem with my session variables that wasn't there a week ago. I've got a bunch of data stored in session (eg. $_SESSION['stuff']) and noticed that any PHP code that sets a variable with the same name as the index (eg. $stuff) is wiping-out the session variable. Does anyone know if there is a PHP setting that is causing this (like register_globals)?


Of course it is register_globals, and using ini_set() won't work - it is too late!

You'll need to either switch to PHP 5 if you can, or follow these directions but modify them to turn off register_globals:

http://wiki.dreamhost.com/index.php/PHP.ini



cool Atropos | openvein.org

Re: Session variables getting over-written

Posted by: cedric
Posted on: 2006-08-08 06:44:00

Thanks Atropos7. I really appreciate the help.

Tags: php codesession variablesphp4stuffdreamhostglobalsiniappreciatedluckcgirunningregisterindexhelp