• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 Cannot send headers

#1
We encounter the following error several times a day, I don't see any add-on code running in the stack trace, is it related to XF or some other server configuration?

Code:
Error Info
Zend_Controller_Response_Exception: Cannot send headers; headers already sent in , line 0 - library/Zend/Controller/Response/Abstract.php:321
Generated By: Unknown Account, Today at 7:52 AM

Stack Trace
#0 /home/xenforo/forum/library/Zend/Controller/Response/Abstract.php(115): Zend_Controller_Response_Abstract->canSendHeaders(true)
#1 /home/xenforo/forum/library/XenForo/ViewRenderer/Abstract.php(63): Zend_Controller_Response_Abstract->setHeader('X-Frame-Options', 'SAMEORIGIN')
#2 /home/xenforo/forum/library/XenForo/ViewRenderer/HtmlPublic.php(18): XenForo_ViewRenderer_Abstract->__construct(Object(XenForo_Dependencies_Public), Object(Zend_Controller_Response_Http), Object(Zend_Controller_Request_Http))
#3 /home/xenforo/forum/library/XenForo/Dependencies/Public.php(207): XenForo_ViewRenderer_HtmlPublic->__construct(Object(XenForo_Dependencies_Public), Object(Zend_Controller_Response_Http), Object(Zend_Controller_Request_Http))
#4 /home/xenforo/forum/library/XenForo/FrontController.php(568): XenForo_Dependencies_Public->getViewRenderer(Object(Zend_Controller_Response_Http), 'html', Object(Zend_Controller_Request_Http))
#5 /home/xenforo/forum/library/XenForo/FrontController.php(141): XenForo_FrontController->_getViewRenderer('html')
#6 /home/xenforo/forum/index.php(13): XenForo_FrontController->run()
#7 {main}

Request State
array(3) {
  ["url"] => string(88) "https:/***.com/forum/threads/***.6147/"
  ["_GET"] => array(1) {
    ["/forum/threads/***_6147/"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}
 

Mike

XenForo developer
Staff member
#2
Because PHP doesn't have any details of the file/line where the headers were sent, that certainly looks like something more internal to PHP.

I certainly don't understand why this would be sporadic. It seems like it should be happening every time. You may need to be able to catch the error happening so that you can see what has been output.

As a possible workaround, check if display_errors is active in your php.ini file. If so, disabling it may prevent the issue. If you have PHP errors being logged anywhere (potentially into your web server error_log file), then that may also give you some details as to the problem.