CakePHP – Warning (2): Cannot modify header information

I going through Cake’s 15min Blog Tutorial (again) and I hit a problem after I’d added the add and delete functions to the controller.
My list of blog posts displays fine, clicking on the “Add Post” link from the index works fine – but when I submit the add form I get the following warning:
Warning (2): Cannot modify header information - headers already sent by (output started at /var/www/cake/app/models/post.php:9) [CORE/cake/libs/controller/controller.php, line 644]
I was getting this when I tried to delete a post too.
Turns out that there was extra whitespace after the ?> closing PHP element in my post.php – removing it fixed the problem.
UPDATE: I’ve found a solution to this problem.
Subscribe via RSS
RSS via Email
Follow me