Re: HTTP headers and include()

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

 



On Sun, Jul 12, 2009 at 11:27 PM, James Colannino <james@xxxxxxxxxxxxx>wrote:

> 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

[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