php-hp Posted January 22, 2008 Share Posted January 22, 2008 Hi, I have updated my server from php4.1 to php5. Everything was grand until i noticed that my scripts using session_register was not holding the registered values. Sample code from php4.1 *************************** <?php session_start(); session_register("exprmt"); ?> *************************** Before any html headers are sent out! And calling back using *************************** <option value="exprmt" selected><? echo $exprmt; ?></option> *************************** Worked fine in php4.1 with globals on "Internal server". Have tried *************************** <?php session_start(); $_SESSION['exprmt'] - ' '; ?> *************************** and calling back using *************************** <option value="exprmt" selected><? echo $_SESSION['exprmt'] ?></option> *************************** But still doesnt hold the value! The page is calling itself using php_self Any Ideas???? Cheers.......... Link to comment https://forums.phpfreaks.com/topic/87214-php5-sesseion-problem/ Share on other sites More sharing options...
trq Posted January 22, 2008 Share Posted January 22, 2008 session_register has long been depricated, to assign values to the session array simpl use... session_start(); $_SESSION['foo'] = 'bar'; Link to comment https://forums.phpfreaks.com/topic/87214-php5-sesseion-problem/#findComment-446094 Share on other sites More sharing options...
PFMaBiSmAd Posted January 22, 2008 Share Posted January 22, 2008 For your second set of code that you tried, turn on full php error reporting and then check your web server log file for any errors. If that code is on one single page, it should work if the session is starting (unless the code in the short open <? tag is not being parsed by php and is simply showing up in the view source of the page in your browser.) Beyond this, you would need to post your code to get specific help. For example $PHP_SELF is dependent on register globals and your page might or might not work depending on how it is being used. Link to comment https://forums.phpfreaks.com/topic/87214-php5-sesseion-problem/#findComment-446146 Share on other sites More sharing options...
revraz Posted January 22, 2008 Share Posted January 22, 2008 Also in your new PHP.INI file, make sure the session save path is set correctly Link to comment https://forums.phpfreaks.com/topic/87214-php5-sesseion-problem/#findComment-446151 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.