Re: trouble with headers

From: Date: Wed, 13 Feb 2002 02:10:30 +0000
Subject: Re: trouble with headers
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-84529@lists.php.net to get a copy of this message
You're right Erik. Subtle, ain't it? On the other hand, look how accepting browsers are of malformed HTML. I'm inclined to think that today they see the <HTML> tag and 'think': "So, we assumed HTML anyway." Cheers - Miles Thompson At 08:57 PM 2/12/2002 -0500, Erik Price wrote:
Sorry, I debugged it myself. Don't add extra whitespace lines after you jump out of PHP mode (for instance, at the end of an include file, don't have any extra lines after the '?> PHP-jump-out mark'. The extra lines at the bottom of the functions include file was being interpreted as the end of the headers. (Man that book on HTTP I was reading at the library came in handy! Perl Web Client Programming or something) It isn't truly HTML since it isn't between the <html> and </html> tags, but it gets sent along as blank lines in the HTML document. That's my theory , anyway. Erik On Tuesday, February 12, 2002, at 08:50 PM, Erik Price wrote:
I've run into a problem: At the top of each page in my site I have a couple of include files. They handle simple things, really -- a session_start() in one of them, as well as a check for a session variable to make sure that the user is logged in. In another one, I have my database connection parameters. Yet another include file contains my functions. They are all actually included into one central include file called "common.inc", and this file is included at the top of each page in my site. None of these output any HTML at this point -- they only do behind-the-scenes PHP work and preparation for the page about to be displayed below. Nonetheless, I have a "header('Location: n')" function just under the include("./common.inc") function, and it refuses to work. The error message says that the headers have already been sent, at line 109 of my functions includefile. This in itself is strange, because the last line of the functions includefile that has any instructions on it is 103, the next six lines are just empty whitespace. I would think that my header() function would work, because I haven't outputted any HTML yet (such as the <html> tag or the DOCTYPE). I haven't outputted any text at all. But the header() doesn't work, because it seems to think that the headers have already been sent. At what point in the HTTP exchange do the "headers" finish being sent? Is there a timeout, or a certain line, or what? I thought that it was a blank line, but since I haven't outputted any text, I am not sure how that's possible. Erik
---- Erik Price Web Developer Temp Media Lab, H.H. Brown pricee@hhbrown.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#84529) next »