Re: HTTP headers and include()

From: Date: Thu, 23 Aug 2001 01:06:40 +0000
Subject: Re: HTTP headers and include()
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-63999@lists.php.net to get a copy of this message
On Thu, 23 Aug 2001 10:06, Casteele/ShadowLord wrote: > Andy <ajh@vmei.acad.bg> wrote in article > <003b01c12b23$d1f245d0$0b01a8c0@ANDreY>... > > > See if is there some kind of echo before header()s, or HTML sent to > > browser. > > No, I've been extremely careful to avoid that. The following are the > two test files I've been using to try to solve this.. (sans the > ---------- File Begin/End ----------) > > lib.php: > ---------- File Begin ---------- > <?php > function do_nothing() {} > ?> > ---------- File End ---------- > > test.php > ---------- File Begin ---------- > <?php > include_once("lib.php"); > if( headers_sent ) { > $senthdrs = "Headers Sent"; > } else { > $senthdrs = "Headers not sent"; > } > ?><html> > <head><title>PHP Lib Test</title></head> > <body><h1>PHP Lib Test</h1><hr> > <?php > echo( $senthdrs ); > ?></body> > </html> > ---------- File End ---------- > > End result: > PHP Lib Test > ------------------------------------------------------------ > Headers sent > > > From what I can tell from the documentation and through > experimentation, either there's additional headers being generated when > php includes the content (a content-type header maybe?) or more likely, > after php is done parsing the file and 'removing' the code, it comes > back as a single CRLF, which triggers Apache/PHP to send the headers. > Actually, that setup makes sense to me, but I'm trying to find out if > there is a way around it. > > Thanx > Cas Check your included file for _ANY_ blank lines outside the <?php tags. That will be enough to trigger the problem. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA How long will a floating point operation float?

« previous php.general (#63999) next »