I am receiving the following error in my system.log file:
2011-01-12T14:16:52+00:00 DEBUG (7): HEADERS ALREADY SENT:
[0] C:\\xampp\\htdocs\\www.mysite.com
Here's the hard way.
Find the location in the file that's doing the logging
C:\xampp\htdocs\www.mysite.com\app\code\core\Mage\Core\Controller\Response\Http.php
Mage::log('HEADERS ALREADY SENT: '.mageDebugBacktrace(true, true, true));
Add logging to get a copy of every file included/required so far
Mage::log(print_r(get_included_files(),true));
You can add this logging directly to the core file if you remember to restore the file to it's pre messed with condition, or you can add a temporary copy at
app/code/local/Mage/Core/Controller/Response/Http.php
as long as you remember to remove it when you're done (or just use git).
Check this list of files for the usual white-space suspects, and then check them for any functions that might produce output (echo
, print
, readfile
, there's probably more)
In our case this was a bug in Magento CE 1.9.2.4, which was fixed in Magento CE 1.9.3, happened when using WYSIWYG with images. We just made a little extension which overwrites the function directiveAction() in \app\code\core\Mage\Adminhtml\controllers\Cms\WysiwygController.php. For more Details see (in German) here.
I received this error when I built my Ajax request in a "hacky" way, echoing the contents directly instead of sending them out through the layout. Once I sent them out through the layout, the errors disappeared. See my own question here:
Best way to output ajax data from a Magento Admin Extension
props to @alan for his answer to my question.
Same Issue while making Ajax Call
I was getting the Log when i was making Ajax call and calling the template directly from controller.
When i changed the code and created block in layout xml file. the log error got fixed.
The most common place you run into this in Magento is when you output content directly from the controller.
Instead of doing
echo $string;
within a controller, do this:
$this->getResponse()->setBody($string);