Why do I get “Can send headers – Headers already sent at line nnn”?
There cannot be any output sent to the browser before using sessionStart(), sessionRegister() or header(). While you may not have meant to do so, something in the php script has sent output to the browser. Most often this is white space (spaces, new lines, etc) that are perhaps there for readability. The following php code will cause this error: 1: 2: 3: 7: The white space at line 2 is output to the browser, so the sessionStart() at line won’t be allowed and you’ll receive the “headers already sent message.” Here are two solutions: 1. Find the offending white space, and remove it. Note that it could be in an include or require statement. php tells you where the output started, look there. 2. Use output buffering. See the manual at http://www.php.net/manual/en/ref.outcontrol.php To add on to that, it’s okay to have white space within php tags, but if you are using sessions, or the header() function, no text can be sent to the browser, includin
Related Questions
- The FHCF audit notice requires that information be sent in advance of the audit. Why is it necessary to send the information in advance?
- Is each trading partner required to send a list of FEINS for claims administrators whose data will be sent under its sender ID?
- Why do I get "Can send headers - Headers already sent at line nnn"?