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
Maybe it will be helpful for someone: I get similar message when I turn on Magento's WYSIWYG when editing pages in CMS -> Pages (I've got WYSIWYG disabled by default so I have to click "Show/Hide Editor" in order to enable it). If page contains CMS tags such as for example:
{{store url='my-other-page'}}
this message apears in the system.log after I click "Show/Hide Editor":
2013-04-06T11:10:38+00:00 DEBUG (7): HEADERS ALREADY SENT: <pre>[0] ...\app\code\core\Mage\Core\Controller\Response\Http.php:52
[1] ...\lib\Zend\Controller\Response\Abstract.php:766
[2] ...\app\code\core\Mage\Core\Controller\Response\Http.php:83
[3] ...\app\code\core\Mage\Core\Controller\Varien\Front.php:188
[4] ...\app\code\core\Mage\Core\Model\App.php:354
[5] ...\app\Mage.php:683
[6] ...\index.php:87
</pre>
Here's an easier way.
Look at the canSendHeaders
method in file
lib/Zend/Controller/Response/Abstract.php
Add some logging to
public function canSendHeaders($throw = false)
{
$ok = headers_sent($file, $line);
// to get PHP's report on which file is sending a header.
if ($ok !== false){
Mage::log('File: ' . $file, null, 'exception.log', true);
Mage::log('Line: ' . $line, null, 'exception.log', true);
}
if ($ok && $throw && $this->headersSentThrowsException) {
#require_once 'Zend/Controller/Response/Exception.php';
throw new Zend_Controller_Response_Exception('Cannot send headers; headers already sent in ' . $file . ', line ' . $line);
}
return !$ok;
}
That error is thrown from Mage_Core_Controller_Response_Http -> sendHeaders(). This function calls the super class function that actually does the check to see whether or not headers have already been sent, Zend_Controller_Response_Abstract -> canSendHeaders().
The Zend_Controller_Response_Abstract class handles, among other things, sending response headers and tracking the last time the headers were sent (and from what file and line). Here is what that function looks like, and where we'll make a change around line 316 to lib\Zend\Controller\Response\Abstract.php:
public function canSendHeaders($throw = false) {
$ok = headers_sent($file, $line);
if ($ok && $throw && $this->headersSentThrowsException) {
#require_once 'Zend/Controller/Response/Exception.php';
throw new Zend_Controller_Response_Exception('Cannot send headers; headers already sent in ' . $file . ', line ' . $line);
}
return !$ok;
}
To:
public function canSendHeaders($throw = false)
{
$ok = headers_sent($file, $line);
if ($ok) {
Mage::log('Cannot send headers; headers already sent in ' . $file . ', line ' . $line, null, 'headers.log');
}
return !$ok;
#if ($ok && $throw && $this->headersSentThrowsException) {
# #require_once 'Zend/Controller/Response/Exception.php';
# throw new Zend_Controller_Response_Exception('Cannot send headers; headers already sent in ' . $file . ', line ' . $line);
#}
#return !$ok;
}
This will log the error in /var/log/header.log.
I see this too. I think it has something to do with images in WYSIWYG. Try watching the logs whilst going through the admin (especially CMS pages) and you might see it happen. It's harmless.
I think this might be OnePageCheckout
extension problem. I have the same error in Magento, and seems that this error is not so popular. Also I have OnePageCheckout
installed. But, of course, this might be just coincidence.
I have the same problem while installing Magento.
In my case enabling output_buffering in PHP solved the issue.
In xampp with PHP 5.6 output_buffering is enabled by default.
In xampp with PHP 5.3 output_buffering is disabled by default.