Re: HTTP headers and include()

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

 



On Fri, Jul 10, 2009 at 1:21 AM, James Colannino<james@xxxxxxxxxxxxx> 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



[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