Re: HTTP headers and include()

From: Date: Thu, 23 Aug 2001 00:36:20 +0000
Subject: Re: HTTP headers and include()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-63988@lists.php.net to get a copy of this message
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

« previous php.general (#63988) next »