Session variables and redirects aren't working the same after I upgraded from PHP 3.x to PHP 4.35 on win2000.
April 16, 2004 6:38 AM Subscribe
php 4.35/win 2000/cgi question: having problems after upgrading from 3.x with session variables and redirects? any suggestions?
variable things have changed in php4. for one, register_globals is off, as well it should. accessing the variables should be done through the new super globals that were introduced in php4. here is a link about them.
you should use session_start() to start your session, but for setting and retrieving session variables, you should just use the $_SESSION array. no need for session_register() any more.
also, what redirect problems are you having?
posted by chrisroberts at 7:20 AM on April 16, 2004
you should use session_start() to start your session, but for setting and retrieving session variables, you should just use the $_SESSION array. no need for session_register() any more.
also, what redirect problems are you having?
posted by chrisroberts at 7:20 AM on April 16, 2004
Response by poster: chris. cool. i know there was a problem with sessions on win2000/cgi/php 4.2x ...
"On the **CGI** version of PHP on IIS 5.0/Windows 2000, the following code will not work as expected:
the code in question isn't mine - but is hosted on my box which just received the php upgrade
"Setting session variables, and then redirecting the user to a different page using header("Location: blah.php") results in the session disappearing."
malph - temp directory is properly set ...
thanks again.
posted by specialk420 at 7:35 AM on April 16, 2004
"On the **CGI** version of PHP on IIS 5.0/Windows 2000, the following code will not work as expected:
/***** sess1.php *****/
session_start();
$_SESSION["key1"] = "testvalue";
header("Location: sess2.php");
/***** sess2.php *****/
session_start();
echo "key1 = '".$_SESSION["key1"]."'";
"the code in question isn't mine - but is hosted on my box which just received the php upgrade
"Setting session variables, and then redirecting the user to a different page using header("Location: blah.php") results in the session disappearing."
malph - temp directory is properly set ...
thanks again.
posted by specialk420 at 7:35 AM on April 16, 2004
Is it actually writing to the temp folder when you create a session, specialK? It should (theoretically) be writing little files to c:\php\sessiondata when it begins the session.
posted by ph00dz at 8:31 AM on April 16, 2004
posted by ph00dz at 8:31 AM on April 16, 2004
Response by poster: eah - actually two sessionfiles, one blank, one with the initial session data.
i don't mean to scrounge for debugging help on an app that isn't my code, - but if you have any further suggestions ... please feel free to send.
posted by specialk420 at 9:10 AM on April 16, 2004
i don't mean to scrounge for debugging help on an app that isn't my code, - but if you have any further suggestions ... please feel free to send.
posted by specialk420 at 9:10 AM on April 16, 2004
Try calling session_write_close() before you redirect.
posted by sad_otter at 12:02 PM on April 16, 2004
posted by sad_otter at 12:02 PM on April 16, 2004
Response by poster: ill dig in and see if it is a code issue. thanks nice php peeps.
posted by specialk420 at 3:14 PM on April 16, 2004
posted by specialk420 at 3:14 PM on April 16, 2004
This thread is closed to new comments.
posted by malphigian at 7:01 AM on April 16, 2004