I have just spent too long trying to discover why a controller throws a "Cannot modify header information - headers already sent by..." error message. There's no obvious reason why, and no obvious fix. The controller works fine on another installation of Apache2 and PHP, but not on my machine at home.
The problem? White space after the closing ?>
PHP tag. You can have as many carriage returns as you like, but don't try a space. Turns out it was reported here 9 months ago. The team's response is perfectly acceptable, but it's quite a hard little caveat to track down and fix! Here's hoping this will be of use to someone else in distress.