Re: HTTP headers and include()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux