0

我新安装了shopware php framework 5.1.5(新数据库,新文件)。但是,当我想在后端更改某些内容并按保存时,我收到以下错误:PHP 致命错误:未捕获异常 'Zend_Controller_Response_Exception' 并带有消息'无法发送标头;标头已发送,第 0 行'

我知道此错误的正常原因是发送标头之前的字符时。但在这种情况下,我有'0'行,当我查看文件“Abstract.php”时,标签“{?php”是正确的(之前没有字符,编码看起来很好)并且在文件末尾没有结束标签在那儿。

任何想法它可以是什么或我如何解决问题?谢谢

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
4

1 回答 1

0

我可以解决问题。原因是另一个错误。我首先认为它不重要并且可以忽略的“警告”。

[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

在我输入 php.ini 后,以下设置有关标题的错误消失了。

 always_populate_raw_post_data=-1

看起来有关 $HTTP_RAW_POST_DATA 的警告在发送标头之前已发送到 std 输出,这当然会产生有关标头的错误。

于 2016-08-21T10:31:21.183 回答