Jump to content

works on windows not on linux issue..


matleeds

Recommended Posts

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

 

Link to comment
Share on other sites

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);

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.