PHP header problems porting from FreeBSD to Win XP

Posted on 2004-04-28
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?

Question by:thujone

Expert Comment

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.

Expert Comment

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

Accepted Solution

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

header("location: xxx.php");

whit this you turn on the buffer

try it


Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Order table with macro 3 75
Batch file output 20 77
wordmultiple challenge 12 90
C# DataGridView_RowsAdded event not firing 1 38
RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now