Re: Re: php error message

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

 



Chuck Anderson wrote:
Ben wrote:

Edward Martin said the following on 11/17/2005 04:27 PM:

"Warning: Cannot modify header information - headers already sent by
(output started at
/usr/home/ecmartin/public_html/ethics06/calendarlogin.php:8) in
/usr/home/ecmartin/public_html/ethics06/sas.php on line 34"

It means you are trying to change the page's headers after they have already been sent to the user's browser. You are probably trying to use the header() function after HTML/Javascript/what have you has already been sent to the browser. If you need to use header() you should write any earlier output to a variable and only output it to the browser after any header() function use.

- Ben
Most likely that is exactly what's happening. To be even more clear - the solution is to use the header function before any HTML (before *any* output). I learned this when I had an include file that was all Php causing this problem. The end of the included file had a carriage return after the closing tag ?>. That was a nasty one to locate. Now I always make sure there is no white space after the closing tag in files I might include somewhere else.

An alternative solution is to just turn on output buffering, which will make sure no output gets sent until after all PHP has stopped processing (unless you specifically tell it to get sent earlier).

Jasper

--
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