Re: Re: session error ... I think
| From: | Martin Clifford | Date: | Thu, 11 Jul 2002 17:46:14 +0000 |
| Subject: | Re: Re: session error ... I think | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-107194@lists.php.net to get a copy of this message | ||
When you request a page, for instance, php.net, your web browser sends HTTP headers to the server
that holds php.net on it. When the server receives these HTTP headers, it knows which page is
needed, and sets up it's own headers to send back to the browser, such as location, file types,
etc. It then sends back the requested page with all the appropriate header information to the
browser, which displays the page.
Where your question comes into play is somewhere in the middle. You can set the HTTP headers only
AFTER the request to the server has been made, but has to be BEFORE the page arrives at the client
browser for display. So, when we all say that there can be NOTHING output to the HTML file before
the headers are sent, we mean it literally.
For example: Open up Notepad. Hit return once, then type this in:
<?php header("Location: index.php"); ?>
Upload it and run it. You'll get an error. Why? Because you sent a hard return to the HTML
output BEFORE the header was sent. Hopefully this is not all jumbled an unhelpful. Heh :o)
Good Luck!
Martin
>>> Chris Hewitt <g0pae@manordat.demon.co.uk> 07/11/02 01:40PM >>>
Alexander Ross wrote:
>I'm slowly beginning to undrestand this, but please bear with a php novice.
>When/how were the headers sent? In other words, how do I know that they
>have already been sent?
>
Because something other than a header has gone out. As something other
has gone out, it is not possible to send more headers. Thus headers that
were to be sent must have already been sent. I interpret this error
message as "Something other than headers has already been sent so you
cannot send headers now.", (but then I have been known to be wrong).
HTH
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php