简体   繁体   中英

Shopware error Uncaught exception 'Zend_Controller_Response_Exception' with message 'Cannot send headers; headers already sent in, line 0'

I freshly installed the shopware php framework 5.1.5 (new DB, new files). But when I like to change something in the backend and press save then I get the following error: PHP Fatal error: Uncaught exception 'Zend_Controller_Response_Exception' with message 'Cannot send headers; headers already sent in , line 0'

I know that the normal cause of this error is when a character before the header is sent. But in this case I have line '0' and when I look at the file "Abstract.php" the tag "{?php" is correct (no characters before, encoding looks fine) and at the end of the file no closing tag is there.

Any ideas what it else can be or how I can nail the problem down? Thx

PHP Fatal error:  Uncaught exception 'Zend_Controller_Response_Exception'   with message 'Cannot send headers; headers already sent in , line 0' in /var/www/vhosts/skate.ch/dev.skate.ch/shop/engine/Library/Zend/Controller/Response/Abstract.php:323
Stack trace:
#0 /var/www/vhosts/skate.ch/dev.skate.ch/shop/engine/Library/Zend/Controller/Response/Abstract.php(115): Zend_Controller_Response_Abstract->canSendHeaders(true)
#1 /var/www/vhosts/skate.ch/dev.skate.ch/shop/engine/Library/Enlight/Controller/Plugins/Json/Bootstrap.php(123): Zend_Controller_Response_Abstract->setHeader('Content-type', 'application/jso...', true)
#2 [internal function]: Enlight_Controller_Plugins_Json_Bootstrap->onPostDispatch(Object(Enlight_Controller_ActionEventArgs))
#3 /var/www/vhosts/skate.ch/dev.skate.ch/shop/engine/Library/Enlight/Event/Handler/Default.php(91): call_user_func(Array, Object(Enlight_Controller_ActionEventArgs))
#4 /var/www/vhosts/skate.ch/dev.skate.ch/shop/engine/Library/Enlight/Event/EventManager.php(213): Enlight_Event_Handler_Default- in /var/www/vhosts/skate.ch/dev.skate.ch/shop/engine/Library/Zend/Controller/Response/Abstract.php on line 323

I could solve the problem. The cause was another error resp. a "warning" which I thought first it is not important and can be ignored.

[20-Aug-2016 11:04:26 CET] PHP Deprecated:  Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. 
To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0

After I entered in the php.ini the following setting the error regarding the headers disappeared.

 always_populate_raw_post_data=-1

It looks like that the Warning regarding $HTTP_RAW_POST_DATA is sent to std output before the headers get sent, which then produces of course the error regarding the headers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM