?
Solved

PHP header problems porting from FreeBSD to Win XP

Posted on 2004-04-28
3
Medium Priority
?
221 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 200 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A short article about problems I had with the new location API and permissions in Marshmallow
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Six Sigma Control Plans

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