PhpTim Posted August 10, 2007 Share Posted August 10, 2007 Hi Everyone, Basically I have moved a website from a Linux based system Running PHP to a Windows based sytem with IIS 6 with PHP 5 isapi plugin. (Not my decision) Both version 5.2.3 My troubles lay with Sessions. session_start(); // Session not previously set if( $_SESSION['Sname'] != '' ){ //Condition } The above statement works on the linux box but fails on the windows box. with the error being: Notice: Undefined index: Sname and every session variable after that receives the error Notice: Undefined variable on the windows box I have the right permissions I believe set for the session files. I can even visually confirm the sessions files are being created. Any help would be appreciated as trying to fix this website would take too long (not written by myself trust me) Thanks in Advance Quote Link to comment https://forums.phpfreaks.com/topic/64267-session-troubles/ Share on other sites More sharing options...
lemmin Posted August 10, 2007 Share Posted August 10, 2007 Try using the isset() function: if(isset($_SESSION['Sname'])){ Quote Link to comment https://forums.phpfreaks.com/topic/64267-session-troubles/#findComment-320383 Share on other sites More sharing options...
PhpTim Posted August 10, 2007 Author Share Posted August 10, 2007 Certainly that would solve my problem. What has happened as I had this site dumped into my hands. I don't really want to have to repair someone elses failures. they have unwisely used sessions everywhere making the above suggestion such a pain and time consumer. Quote Link to comment https://forums.phpfreaks.com/topic/64267-session-troubles/#findComment-320387 Share on other sites More sharing options...
lemmin Posted August 10, 2007 Share Posted August 10, 2007 I don't think there is a way to fix your problem without making SOME sort of change to all those lines. If you have a program like Dreamweaver, you can search for "if( $_SESSION['Sname'] != '' )" and do a replace all with "if(isset($_SESSION['Sname']))". Sit back and watch it happen. I don't know the differences between windows and linux running php. One of the causes might be that error outputting was turned off completely on the linux box, but the error really was occurring. If you don't plan on doing any more debugging, you can try turning it off on the windows box, assuming the code actually works when it outputs the errors. Quote Link to comment https://forums.phpfreaks.com/topic/64267-session-troubles/#findComment-320398 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.