This typically occurs when there is unintended output from the script before you start session. With you current code, you could try to use output buffering to solve it.
try adding a call to the ob_start(); function at the very top of your script and ob_end_flush(); at the very end of the document.
I had this same problem. I develop on Windows XP using Notepad++ and WampServer to run Apache locally and all was fine. After uploading to hosting provider that uses Apache on Unix I got this error. I had no extra PHP tags or white-space from extra lines after the closing tag.
For me this was caused by the encoding of the text documents. I used the "Convert to UTF-8 without BOM" option in Notepad++ and reloaded to the web server. Problem fixed, no code/editing changes required.