Solved

PHP header problems porting from FreeBSD to Win XP

Posted on 2004-04-28
3
218 Views
Last Modified: 2010-04-17
I have a PHP site (newest version) that works fine on FreeBSD.

But when I try to port it to my XP laptop so I can work at home, I get errors trying to use the header() redirect.

For instance, a line like this:

     header("location: xxx.php");

will get me an error that says I've already printed out the headers and I can't do it again. It's just not true.

I assume there's either a problem with files being Unix style in XP. Or maybe there's just an Apache or PHP setting I can change?

TIA,
Rich
0
Comment
Question by:thujone
3 Comments
 
LVL 8

Expert Comment

by:alexhogan
ID: 10943299
You need to insure that you are not printing out any header information before sending the redirect.

Put your header("location: xxx.php"); as the first thing before any header information and you should be fine.
0
 
LVL 5

Expert Comment

by:danielsonchris
ID: 10944005
Also, check if you are getting any Notices or Warnings prior to that header(...) call.  That can cause the issue too.  
Regards,
Chris
0
 

Accepted Solution

by:
Dany_mx earned 50 total points
ID: 10944833


First open the php file with wordpad (no notepad) and save all the page, with this you change de LF to CR LF


and in your code you can test the follow

<?
ob_start();
header("location: xxx.php");
ob_end_flush();
.....
.....
?>

whit this you turn on the buffer

try it

0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question