View Single Post
  #4 (permalink)  
Old August 13th, 2004, 04:22 AM
Daniel Walker Daniel Walker is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, but I'm not talking and about a HTML <head /> header: I mean a hypertext MIME header - stuff like:

Expires: Mon, 26 Jul 1997 05:00:00 GMT"
Last-Modified: Monday,11th May 2003 19:06:13 GMT"
Cache-Control: no-cache, must-revalidate"
Pragma: no-cache
Content-type: application/x-msexcel
Content-Disposition: attachment; filename=$file
Content-Description: PHP Generated Data

...the likes of which a webserver wraps around an excel spreadsheet, text file, or any other content, in order to send it across the web. In deed, it is these headers, not the HTML headers that the PHP header directive modifies. Web servers will attempt to automatically wrap appropriate headers around any content they are asked to send. If there is white space before the opening <?php tag in your PHP file, the server will wrap a MIME header around it. Indeed, even if the script was working, the moment you made a call to header('loaction...' the server would have to generate a header on the fly, for you, to hold your header modification.

The error is saying that something has caused the server to generate a header for you already, so you cannot modify it. The most likely cause is whitespace.

Take it easy,
Dan
Reply With Quote