Solved

PHP header problems porting from FreeBSD to Win XP

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?

765 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