hammadtariq Posted January 7, 2007 Share Posted January 7, 2007 Is there any problem in session handling functions of php 5.1.5?Suppose I store member id in session["id"] on login and recall this variable again and again where I need to show options or membername who is logged in.This was working exactly fine in all earlier versions on my machine, running IIS, windows xp, and php 5.1.4, it was working perfectly.Now what is happening on my server, where I set AddHandler application/x-httpd-php5 .phpin my .htaccess because some classes in my code need php 5. Following is happening.$id=$_SESSION["id"]; //outputs $id=1 which is correct$id=$_GET["somepassedvariable"]; //outputs $id=765 which is also correctnow if i again check $_SESSION["id"] this will be changed to 765 means:$id=$_SESSION["id"]; //outputs $id=765 which is wrong as nonewhere in the code session variable is changed!Did any one know this? Is it a bug? I am tracking this thing down from yesterday, it has taken all my night and now I finally believe that its some bug in php 5.1.5!What you people say? Quote Link to comment https://forums.phpfreaks.com/topic/33203-session-handling-problem-in-php-515/ Share on other sites More sharing options...
wildteen88 Posted January 7, 2007 Share Posted January 7, 2007 Sounds like a regsiter globals problem to me. Open your php.ini and disable regsiter_globals (change [tt]register_globals = On[/tt] to [tt]register_globals = Off)[/tt]Save the php.ini and restart Apache Quote Link to comment https://forums.phpfreaks.com/topic/33203-session-handling-problem-in-php-515/#findComment-154999 Share on other sites More sharing options...
hammadtariq Posted January 7, 2007 Author Share Posted January 7, 2007 yah, thanx wildteen, they were On. How to turn them off through .htaccess? Quote Link to comment https://forums.phpfreaks.com/topic/33203-session-handling-problem-in-php-515/#findComment-155034 Share on other sites More sharing options...
wildteen88 Posted January 7, 2007 Share Posted January 7, 2007 Add the following flag to the htaccess:[tt]php_flag register_globals Off[/tt] Quote Link to comment https://forums.phpfreaks.com/topic/33203-session-handling-problem-in-php-515/#findComment-155060 Share on other sites More sharing options...
hammadtariq Posted January 7, 2007 Author Share Posted January 7, 2007 [quote author=wildteen88 link=topic=121367.msg499010#msg499010 date=1168186776]Add the following flag to the htaccess:[tt]php_flag register_globals Off[/tt][/quote]i have tried doing this but it is giving 500 Internal Server Error! Quote Link to comment https://forums.phpfreaks.com/topic/33203-session-handling-problem-in-php-515/#findComment-155074 Share on other sites More sharing options...
wildteen88 Posted January 7, 2007 Share Posted January 7, 2007 Do you get 500 error still if you use this instead:[tt]php_value register_globals "on"[/tt]If you do which version of Apache do you have installed? Also is PHP configured as an Apache module? As [tt]php_flag[/tt] or [tt]php_value[/tt] only works if PHP is an Apache module. It wont workif PHP is configured as GCI. Quote Link to comment https://forums.phpfreaks.com/topic/33203-session-handling-problem-in-php-515/#findComment-155108 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.