Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I wrote a script that is intended to return multiple headers with information required by the calling scripts. It works fine on my server, which runs PHP 5.2.17, but on my client's server, which runs 5.3.6 it gives http error 500. I have narrowed it down to definitely being caused by a second call to header(). I see in the documentation:

4.4.2 and 5.1.2: This function now prevents more than one header to be sent at once as a protection against header injection attacks.

But if that's the case, is there an environment variable that turns this on and that's why it works on my server, running 5.2.17? Is there any way around it? I've tried putting all three headers I need in one header() call using a "\n" to add a carriage return between them, but that results in them not being sent at all on my server.

Any help is appreciated!

David
Posted
Comments
Peter_in_2780 10-Feb-14 23:12pm    
Just a thought. Pretty sure multiple headers need \r\n as separator, not just \n.

OOPS! Sorry, my memory is seriously rusty on this one.
David Johns 11-Feb-14 19:20pm    
That's a good idea, but unfortunately it didn't make a difference. I forgot to mention, when I have the "\n" or "\r\n" in the header it just doesn't print a header at all.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900