Recently I upgraded to Php 5.4 as mentioned in this link on Ubuntu 12.04 LTS:-
sudo add-apt-repository ppa:ondrej/php5-oldstable
sudo apt-get update
sudo apt-get dist-upgrade
Nothing is changed in my code. But now I am getting the below error:-
E_WARNING Cannot modify header information - headers already sent by (output started at Abstract.php:588) in functions.php on line 55
The relevant code that is throwing the error:-
//Abstract.php
public function outputBody()
{
$body = implode('', $this->_body);
echo $body; //Line 588
}
...
// functions.php
if ($exit) {
if (strtolower(PHP_SAPI) != 'cli') {
header("HTTP/1.1 500 Internal Server Error"); //Line 55
}
echo Bob_Exception_Helper::printException($e, $logStr) . PHP_EOL;
exit (1);
}
I have added the below lines in both /etc/php5/cli/php.ini
and /etc/php5/apache2/php.ini
as mentioned in this question
output_buffering = On
Also everything was working fine on php 5.3. No code change was done after the upgrade. Just after upgrade to Php 5.4 this issue came up.
php --version
PHP 5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1 (cli) (built: Jun 24 2016 08:30:18)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
The php code that is throwing the error:-
public function outputBody()
{
$body = implode('', $this->_body);
echo $body; //As per the warning this line is throwing the error
}
But still getting the same error? Can some one let me know how can I resolve this?