matleeds Posted September 15, 2011 Share Posted September 15, 2011 Hi, I'm not totally sure if this is the right section for this question but... I have my dev environment (my laptop) - windows vista, apache web server, also using my laptop as a client. I have my php project on the web server, I go to the login page in my browser (IE8) and login in, if it's valid it reloads the page with the user detail etc..it works. I've moved it onto a linux server (i think it still uses apache), I go to the login page in my browser (IE8) and login in. A blank page is displayed BUT if i hit refresh the user detail is displayed as expected. Also if I logout, again a blank page (it should display the login page) but when I hit refresh this time, it stays blank. I won't post my code just yet as I was wondering if anyone ever had the same issue before? Windows..works ok, Linux..doesn't work ok till refresh, but even then that doesn't work for the logout. My other thought is that it may work ok in windows because everythings on my laptop as in c:/php and the web server. Not much to go on I know but it may ring a bell with someone. thanks Quote Link to comment https://forums.phpfreaks.com/topic/247213-works-on-windows-not-on-linux-issue/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 15, 2011 Share Posted September 15, 2011 if it's valid it reloads the page with the user detail etc ^^^ How exactly is your page reloading itself after you log in? I suspect this has something to do with sending output (perhaps only a space or something) before a header() redirect that prevents the redirect. However, when you refresh the page, the session variable indicating logged in/out is already in the proper state so that the code displays the expected content. For debugging purposes, add the following two lines of code immediately after your first opening <?php tag on the main page - ini_set("display_errors", "1"); error_reporting(-1); Quote Link to comment https://forums.phpfreaks.com/topic/247213-works-on-windows-not-on-linux-issue/#findComment-1269652 Share on other sites More sharing options...
matleeds Posted September 15, 2011 Author Share Posted September 15, 2011 Hi thanks, I've put in the error settings code and get this back Warning: Cannot modify header information - headers already sent by (output started at /home/limelite/public_html/limelitesolutions.co.uk/matamos/Epointment/index.php:13) in /home/limelite/public_html/limelitesolutions.co.uk/matamos/Epointment/ot/views/header.php on line 38 Quote Link to comment https://forums.phpfreaks.com/topic/247213-works-on-windows-not-on-linux-issue/#findComment-1269654 Share on other sites More sharing options...
PFMaBiSmAd Posted September 15, 2011 Share Posted September 15, 2011 The most likely reason your code 'works' on your development system is because output_buffering is turned on in your master php.ini. That allows your code to improperly output content/html to the browser (it gets buffered instead) before it sends a http header to the browser or tries to set a cookie. If output_buffering is ON, on your development system, turn it off so that the code you develop will work on the widest range of server configurations. You have two choices, either add output buffering to your page (not recommended as it adds to the memory usage and slightly adds processing overhead) OR rearrange the logic on your page so that you put the php code that makes any decisions about redirecting before you output any content/html to the browser. Quote Link to comment https://forums.phpfreaks.com/topic/247213-works-on-windows-not-on-linux-issue/#findComment-1269666 Share on other sites More sharing options...
matleeds Posted September 15, 2011 Author Share Posted September 15, 2011 ok thanks for that..i can only find output_buffering = 4096 in my php.ini file though. Quote Link to comment https://forums.phpfreaks.com/topic/247213-works-on-windows-not-on-linux-issue/#findComment-1269673 Share on other sites More sharing options...
PFMaBiSmAd Posted September 15, 2011 Share Posted September 15, 2011 That sets it to ON, with a specific buffer size. The following will set it to off - output_buffering = off Stop/start your web server to get any changes made to the master php.ini to take effect and use a phpinfo() statement to confirm that the setting was actually changed in case the php.ini that php is using is not the one that you changed. Quote Link to comment https://forums.phpfreaks.com/topic/247213-works-on-windows-not-on-linux-issue/#findComment-1269677 Share on other sites More sharing options...
jcbones Posted September 15, 2011 Share Posted September 15, 2011 For the header issue look: Here Quote Link to comment https://forums.phpfreaks.com/topic/247213-works-on-windows-not-on-linux-issue/#findComment-1269683 Share on other sites More sharing options...
matleeds Posted September 16, 2011 Author Share Posted September 16, 2011 thanks guys...after changing my output_buffering and adding the error reporting I do now get the same error in my dev set up and understand that it is a header related error. I'll mark this as solved and probably post my scripts if I can't track down where the problem specifically is. Quote Link to comment https://forums.phpfreaks.com/topic/247213-works-on-windows-not-on-linux-issue/#findComment-1269817 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.