Re: [PHP] HTTP headers and include()
On Fri, Jul 10, 2009 at 12:49 PM, Michael A. Peters mpet...@mac.com wrote: James Colannino wrote: White space can cause this - make sure your code has ?php as the very top and ? at the very bottom, or the white space may trigger the web server to send a header and the white space as data before the cookie for session_start() is sent. Well, at the end of the file dont put a ? on your php files especially which files you are gonna include at others. It would save you some dreadfull buggy times. Its also practiced in the framework programming.
Re: [PHP] HTTP headers and include()
On Sunday 12 July 2009 12:01:12 Lenin wrote: On Fri, Jul 10, 2009 at 12:49 PM, Michael A. Peters mpet...@mac.com wrote: James Colannino wrote: White space can cause this - make sure your code has ?php as the very top and ? at the very bottom, or the white space may trigger the web server to send a header and the white space as data before the cookie for session_start() is sent. Well, at the end of the file dont put a ? on your php files especially which files you are gonna include at others. It would save you some dreadfull buggy times. Its also practiced in the framework programming. Well, some frameworks insist on it being in there. I tend to always include them, but I use a text editor that I know won't add characters to the end after the final ? -- Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP headers and include()
At 12:09 PM +0100 7/12/09, Ashley Sheridan wrote: On Sunday 12 July 2009 12:01:12 Lenin wrote: On Fri, Jul 10, 2009 at 12:49 PM, Michael A. Peters mpet...@mac.com wrote: James Colannino wrote: White space can cause this - make sure your code has ?php as the very top and ? at the very bottom, or the white space may trigger the web server to send a header and the white space as data before the cookie for session_start() is sent. Well, at the end of the file dont put a ? on your php files especially which files you are gonna include at others. It would save you some dreadfull buggy times. Its also practiced in the framework programming. Well, some frameworks insist on it being in there. I tend to always include them, but I use a text editor that I know won't add characters to the end after the final ? -- Thanks, Ash Ash: I do the same. It would brother me (lack of symmetry) if I didn't include a ? at the end of my scripts. As for additional characters after the ?, I make sure my terminations don't have any. Just because characters can be white space doesn't mean you can't detect them. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP headers and include()
On Fri, Jul 10, 2009 at 12:54 PM, James Colannino ja...@colannino.orgwrote: Eddie Drapkin wrote: HTTP headers are sent and finalized after the first bit of output. I had the same problem before and it turned out to be because I had a close tag ? at the end of a file followed by some whitespace. The solution was to remove the ? from the end of all the files and I haven't closed an entire file since. Perhaps that might be it? Hmm... In fact, I did close all my include files with the ? tag, and per Michael's observation in another response, there is a line of whitespace after the closing tag in my include files. I tried getting rid of the trailing whitespace, and removed the closing tags. Unfortunately, even after that, when I place my include files before session_start, I get the same problem. There's no leading whitespace before the starting ?php tag, so I'm still a little at a loss. It's not too big of a deal though; I simply placed my include files after the call to session_start(). That seems to solve the problem. That's a good practice, (Although not optimal is some application setups ) but I am wondering why you are not getting information about exact place where output is being started. You should get a headers already sent output started at kind of error if you have enabled error reporting with display_errors ON. James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Zareef Ahmed :: A PHP Developer in India ( Delhi ) Homepage :: http://www.zareef.net
Re: [PHP] HTTP headers and include()
Zareef Ahmed wrote: You should get a headers already sent output started at kind of error if you have enabled error reporting with display_errors ON. Actually, I did. I just didn't think to mention it in my first post. The thing was that it said it was coming from one of my includes, even though I wasn't yet printing anything to the browser. That's why I was so confused. I've been following what tedd said in an earlier post (to make session_start() your first line of code) and haven't had a problem since. James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP headers and include()
On Sun, Jul 12, 2009 at 11:27 PM, James Colannino ja...@colannino.orgwrote: Zareef Ahmed wrote: You should get a headers already sent output started at kind of error if you have enabled error reporting with display_errors ON. Actually, I did. I just didn't think to mention it in my first post. The thing was that it said it was coming from one of my includes, even though I wasn't yet printing anything to the browser. That's why I was so confused. Its not only print or echo command which may output. As Michael was pointing even a space can cause this problem. Your error message will tell you about exact location of the problem spot with line number. (If you are only getting this problem after uploading your code to server then your FTP client may be culprit) I've been following what tedd said in an earlier post (to make session_start() your first line of code) and haven't had a problem since. Yes, its a good practice for almost all applications and you should do it always unless you have a reason to do otherwise. If its really hard to maintain (like working with older codebase with lots of references to session_start in the middle of application process) then just putting ob_start at very start of application can also solve the problem. James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Zareef Ahmed :: A PHP Developer in India ( Delhi ) Homepage :: http://www.zareef.net
Re: [PHP] HTTP headers and include()
Eddie Drapkin wrote: HTTP headers are sent and finalized after the first bit of output. I had the same problem before and it turned out to be because I had a close tag ? at the end of a file followed by some whitespace. The solution was to remove the ? from the end of all the files and I haven't closed an entire file since. Perhaps that might be it? Hmm... In fact, I did close all my include files with the ? tag, and per Michael's observation in another response, there is a line of whitespace after the closing tag in my include files. I tried getting rid of the trailing whitespace, and removed the closing tags. Unfortunately, even after that, when I place my include files before session_start, I get the same problem. There's no leading whitespace before the starting ?php tag, so I'm still a little at a loss. It's not too big of a deal though; I simply placed my include files after the call to session_start(). That seems to solve the problem. James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP headers and include()
a single line break after the closing ? will not cause this problem. PHP interpreter will neglect a single line break after ? a good debugger like xdebug will be helpful in this case. u can also see the source code of the file to locate the output. any thing before php warning is the output before session_start()
Re: [PHP] HTTP headers and include()
tedd wrote: At 12:24 AM -0700 7/10/09, James Colannino wrote: Eddie Drapkin wrote: HTTP headers are sent and finalized after the first bit of output. I had the same problem before and it turned out to be because I had a close tag ? at the end of a file followed by some whitespace. The solution was to remove the ? from the end of all the files and I haven't closed an entire file since. Perhaps that might be it? Hmm... In fact, I did close all my include files with the ? tag, and per Michael's observation in another response, there is a line of whitespace after the closing tag in my include files. I tried getting rid of the trailing whitespace, and removed the closing tags. Unfortunately, even after that, when I place my include files before session_start, I get the same problem. There's no leading whitespace before the starting ?php tag, so I'm still a little at a loss. It's not too big of a deal though; I simply placed my include files after the call to session_start(). That seems to solve the problem. James James: As I understand things, that's the way it is supposed to work -- you always start a session page off with session_start() as your first statement. I've had some pages complain that a session has already been started and in that case, I check to see if a session ID is set and it not, then do a session_start(). But, as a matter of habit, I always make session_start() my first line of code. Cheers, tedd If the included file has ?php somefunc() { } ? ?php somefunc() { } ? that will also cause it. Or maybe one of the include files includes a file (IE db connection script) that has white space. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTTP headers and include()
Hey everyone, I've been hard at work on a new web application, and discovered something that I would never have seen coming. I was noticing that when I called session_start() after a few lines of includes, I was getting complaints because the HTTP headers had already been sent out. Then, after putting session_start() above the include lines, suddenly everything was working fine. The files that were included were nothing more than functions; there was no code executing that I could tell up to the point of the call to session_start(). I was just wondering if anybody on the list knows why HTTP headers were being sent out by my includes. I'm sure there's a good reason. I'm just very curious :) Thanks very much in advance. James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP headers and include()
On Fri, Jul 10, 2009 at 1:21 AM, James Colanninoja...@colannino.org wrote: Hey everyone, I've been hard at work on a new web application, and discovered something that I would never have seen coming. I was noticing that when I called session_start() after a few lines of includes, I was getting complaints because the HTTP headers had already been sent out. Then, after putting session_start() above the include lines, suddenly everything was working fine. The files that were included were nothing more than functions; there was no code executing that I could tell up to the point of the call to session_start(). I was just wondering if anybody on the list knows why HTTP headers were being sent out by my includes. I'm sure there's a good reason. I'm just very curious :) Thanks very much in advance. James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php HTTP headers are sent and finalized after the first bit of output. I had the same problem before and it turned out to be because I had a close tag ? at the end of a file followed by some whitespace. The solution was to remove the ? from the end of all the files and I haven't closed an entire file since. Perhaps that might be it? --Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP headers and include()
James Colannino wrote: Hey everyone, I've been hard at work on a new web application, and discovered something that I would never have seen coming. I was noticing that when I called session_start() after a few lines of includes, I was getting complaints because the HTTP headers had already been sent out. Then, after putting session_start() above the include lines, suddenly everything was working fine. The files that were included were nothing more than functions; there was no code executing that I could tell up to the point of the call to session_start(). I was just wondering if anybody on the list knows why HTTP headers were being sent out by my includes. I'm sure there's a good reason. I'm just very curious :) Thanks very much in advance. James White space can cause this - make sure your code has ?php as the very top and ? at the very bottom, or the white space may trigger the web server to send a header and the white space as data before the cookie for session_start() is sent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP HEADERS
kartikay malhotra wrote: Hi all! I use HTTP POST to upload a file. I've a PHP script running on the server. Are HTTP headers passed with this request? How can I see the headers passed to the server? Headers are passed by the client and server with every request. The Firefox Tamper Data extension shows the headers being sent and allows you to modify them on the fly. David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP HEADERS
(sorry for the dup kartikay, forgot to hit reply to all;-) So is the file going from server to server or from a client machine to the server? It sounds like server to server - which if that's the case you can use headers_list() to see what your server is going to be sending out to the other server ( http://www.php.net/manual/en/function.headers-list.php) - otherwise you can use the get_headers() function (http://www.php.net/manual/en/function.get-headers.php) see what headers the client sent you along with the file. -Joe On 6/3/06, kartikay malhotra [EMAIL PROTECTED] wrote: Hi all! I use HTTP POST to upload a file. I've a PHP script running on the server. Are HTTP headers passed with this request? How can I see the headers passed to the server? Thanks KM
[PHP] HTTP HEADERS
Hi all! I use HTTP POST to upload a file. I've a PHP script running on the server. Are HTTP headers passed with this request? How can I see the headers passed to the server? Thanks KM
[PHP] Apache Content Negotiation / PHP / HTTP Headers
Hi, i've tested Apache Content Negotiation with a PHP Content Managment System. Apache works correctly, but doesn't tell PHP what it has done. Example: I have a directory with two files: - test.de.htm - test.en.htm As Apache is configured for Content Negotiation I can enter test in my browser window and get the best suiting page, in my case the test.de.htm. But before I see the htm page, it is parsed by the CMS, using Apache Action AddType application/x-httpd-parse .htm Action application/x-httpd-parse /parser/parser.php?file= Well, now the problem: As I make a HTTP request for test, Apache negotiates for test.de.htm, starts the parser.php as ActionHandler for this .htm file. But PHP doesn't know about the new requested document as there is nothing changed in the original request. Apache writes a *RESPONSE* header (Content-Location: test.de.htm), but PHP does know the Apache response headers only after all PHP generated headers are sent. When I call apache_response_headers() at the beginning of my script, it show's nothing from Apache, if I run it after all my header() calls are done and i've sent the first content data, I can see the Apache Response headers, especially Content-Location:. So I see no way to know about Content Negotiation of Apache before all PHP headers are sent. *But I do need this* Why can't PHP just show all the Apache Response headers immediately ??? This is very important and I think also for many people who have dealt with PHP and Apache Content Negotiation. Please help! Hopefully Wolfgang Ulmer P.S: Please answer also to [EMAIL PROTECTED] as I don't read this newsgroup regularly. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTTP headers, IE and downloading
I'm writing a script to view/download an email-attachment. If the file happens to be an MS Word document and the browser IE (only tried with 6.0), then the download fails. If I choose to download (Content-Disposition: attachment; filename=whatever.doc) then only a part of the file (2/3) is saved to disk. Of course viewing the file doesn't work either. It doesn't seem to matter what I set the Content-Type to since IE seems to ignore that anyway, however I've tried application/msword, application/octet-stream and some others. I've tried all the things said in the comments to the header-function in the online-docs at php.net. I know my Content-Length header is correct and the whole procedure works great with Netscape 7.0 and if the attachment is a zip-file or a jpeg-image it also works in both IE and Netscape. Let's just say I'm stumped and I have googled for a solution for a long time and would be very happy if someone had one... Thanks in advance /Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTTP Headers
Using phpinfo() I can see that the header Last-Modified exists. How do I go about accessing the header?? Thanks, Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP Headers
Hi Paul, @ 7:42:49 AM on 11/21/01, Paul - Zenith Tech Inc wrote: Using phpinfo() I can see that the header Last-Modified exists. How do I go about accessing the header?? http://www.php.net/manual/en/function.header.php http://www.php.net/manual/en/language.variables.predefined.php http://www.php.net/manual/en/function.filemtime.php -- -Brian Clark | PGP is spoken here: 0xE4D0C7C8 Please, DO NOT carbon copy me on list replies. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP Headers
Yes, you can do it, but this is not a PHP feature, it is an HTML trick, the only thing you need to do is create a page which contains a frame only (yes neither two or more, only one frame). Then, when you select a link on this page the URL displayed on the browser does not change. This is a nice and basic trick everyone should know, it's easy and cool. If this fails to you, please, drop me a line and i will try to fix it. Kintups ([EMAIL PROTECTED]) UN FALSO sentido de seguridad es peor que estar inseguro From: Mike Harvey [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP] HTTP Headers Date: Fri, 9 Nov 2001 18:55:16 -0500 Is it possible to redirect to an IP address but have the browser address bar show an URL? Mike H. http://ibiz-tools.com http://vestudiohost.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] _ Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP Headers
On Fri, 2001-11-09 at 15:55, Mike Harvey wrote: Is it possible to redirect to an IP address but have the browser address bar show an URL? assuming you have a valid url with a hostname, just wrap the ip address url inside of a frame that takes up the entire window. --Brent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] HTTP Headers
Is it possible to redirect to an IP address but have the browser address bar show an URL? Mike H. http://ibiz-tools.com http://vestudiohost.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP Headers
On Fri, 9 Nov 2001, Mike Harvey wrote: Is it possible to redirect to an IP address but have the browser address bar show an URL? Assuming that you meant hostname instead of URL since the browser address bar will always display a URL ... No. ~Chris /\ \ / September 11, 2001 X We Are All New Yorkers / \ rm -rf /bin/laden -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP Headers
Boy, that's one of those Imagine the trouble we would get into if we could! questions, isn't it? Just like How do I disable the back button?, or How do I use PHP to feed me the contents of a web browser's hard drive? That said, some hosting services support what is called domain parking, where you can hop on to a URL, and then have that URL displayed in the browser's location bar throughout the browsing experience. The problem is that it's unreliable (you don't know when you're going to burst out of park mode and see the real URL), and the URL that is displayed is relatively static. That is, you will only see the URL, and not any subdirectories. It's obnoxious, and I don't recommend it, but check with your hosting service if that's really the route you want to go. Can't be done with PHP, though. At 03:55 PM 11/9/2001, Mike Harvey wrote: Is it possible to redirect to an IP address but have the browser address bar show an URL? Mike H. http://ibiz-tools.com http://vestudiohost.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] Sliante, Richard S. Crawford http://www.mossroot.com mailto:[EMAIL PROTECTED] AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupéry Push the button, Max! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP headers and include()
On Thursday 23 August 2001 02:36, Casteele/ShadowLord wrote: Andy [EMAIL PROTECTED] wrote in article 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 if( headers_sent ) { $senthdrs = Headers Sent; } else { $senthdrs = Headers not sent; } does it make a difference if you use the proper function call syntax (i.e. ad the () brackets after headers_sent) ? -- Christian Reiniger LGDC Webmaster (http://lgdc.sunsite.dk/) Install once, run forever. Linux. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] HTTP headers and include()
I've written a separate function library for a cluster of web pages, and I then include(slib.php) in each of the web pages, instead of copying 12k of code to each page individually. Some of the pages require (simple) authentication or redirection headers, which some of the code in the library is supposed to handle. Problem is, when I include the library, even though there's no other output to be processed, it still generates the linefeed that triggers sending all the current headers, so if(!headers_sent) {...} fails. Is it possible to include php code without sending headers? I've tried exit() within the library, but that fails to work. Instead, exit causes generation of HTML code (a content type metatag) that is neither in the main page nor the library. I've also tried a simple return() (per the documentation), but that generates a parse error. I'm using Apache 1.3.12, PHP 4.0.2 and Slackware Linux (Not sure which kernel version). Thanks Cas PS: Please CC replies to [EMAIL PROTECTED], since I'm not officially subscribed to this list. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] HTTP headers and include()
See if is there some kind of echo before header()s, or HTML sent to browser. You cannot do this html head Bla bla ?php header(Location : any_script.php\n\n);? /head body /body /html Why? Because there is already content sent to the browser. If some code uses header() place it before any output. As I said sometimes a simple echo() breaks all. Andrey Hristov IcyGEN Corporation http://www.icygen.com 99% - Original Message - From: Casteele/ShadowLord [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 22, 2001 6:52 PM Subject: [PHP] HTTP headers and include() I've written a separate function library for a cluster of web pages, and I then include(slib.php) in each of the web pages, instead of copying 12k of code to each page individually. Some of the pages require (simple) authentication or redirection headers, which some of the code in the library is supposed to handle. Problem is, when I include the library, even though there's no other output to be processed, it still generates the linefeed that triggers sending all the current headers, so if(!headers_sent) {...} fails. Is it possible to include php code without sending headers? I've tried exit() within the library, but that fails to work. Instead, exit causes generation of HTML code (a content type metatag) that is neither in the main page nor the library. I've also tried a simple return() (per the documentation), but that generates a parse error. I'm using Apache 1.3.12, PHP 4.0.2 and Slackware Linux (Not sure which kernel version). Thanks Cas PS: Please CC replies to [EMAIL PROTECTED], since I'm not officially subscribed to this list. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP headers and include()
Andy [EMAIL PROTECTED] 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 headtitlePHP Lib Test/title/head bodyh1PHP Lib Test/h1hr ?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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP headers and include()
On Thu, 23 Aug 2001 10:06, Casteele/ShadowLord wrote: Andy [EMAIL PROTECTED] 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 headtitlePHP Lib Test/title/head bodyh1PHP Lib Test/h1hr ?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? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]