Forums / General Questions / Warning: Headers already sent

Warning: Headers already sent

Views: 812

Results 1 to 7 of 7
17 Feb 2016, 9:40 AM
#1
despatchlip avatar

despatchlip

New Zenner

Join Date:
Feb 2016
Location:
UK
Posts:
3
Plugin Contributions:
0

Warning: Headers already sent

My website is creating a lot of debug files which all consist of the following error:
PHP Warning: Cannot modify header information - headers already sent by (output started at /home/sites/xxxxxx/public_html/xxxxxx/includes/templates/template_default/common/tpl_box_default_left.php:20) in /home/sites/xxxxxx/public_html/owa/owa_coreAPI.php on line 1079

I have read the article which everyone gets referred to at https://www.zen-cart.com/content.php?129-headers-already-sent.

I have checked the file generating the error and can't find any extra spaces, so I guess it must be the code that is wrong?

I have absolutely no idea when it comes to php code and so would appreciate it if someone could tell me what is wrong with the code below (line 20 is the line beginning with the <h3 class):

<!--// bof: <?php echo $box_id; ?> //--> <div class="leftBoxContainer" id="<?php echo str_replace('_', '-', $box_id ); ?>" style="width: <?php echo $column_width; ?>"> <h3 class="leftBoxHeading" id="<?php echo str_replace('_', '-', $box_id) . 'Heading'; ?>"><?php echo $title; ?></h3> <?php echo $content; ?> </div> <!--// eof: <?php echo $box_id; ?> //-->
17 Feb 2016, 10:53 AM
#2
terragirl avatar

terragirl

Zen Follower

Join Date:
Jun 2010
Location:
Austria
Posts:
123
Plugin Contributions:
0

Re: Warning: Headers already sent

how does the beginning of your file look like?

The very first characters should be:

<?php If you don't have any PHP code to follow you can use: <?php ?>

Nothing should come before this.

17 Feb 2016, 11:02 AM
#3
store_support avatar

store_support

New Zenner

Join Date:
Apr 2014
Location:
Polska
Posts:
20
Plugin Contributions:
0

Re: Warning: Headers already sent

Hi
If this is not some stupid typo then it will be hard to help You without digging into code.
As checked this owa is some web analytics code, it may be passing some garbage via left column variables. Im[' assuming you have some sidebox for this analytics?
If so then try to disable this one siebox and check if errors still appears (then you will know what causes it)

17 Feb 2016, 11:02 AM
#4
despatchlip avatar

despatchlip

New Zenner

Join Date:
Feb 2016
Location:
UK
Posts:
3
Plugin Contributions:
0

Re: Warning: Headers already sent

Thanks for the reply.

The file in full is:

<?php /** * Common Template - tpl_box_default_left.php * * @package templateSystem * @copyright Copyright 2003-2005 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: tpl_box_default_left.php 2975 2006-02-05 19:33:51Z birdbrain $ */ // choose box images based on box position if ($title_link) { $title = '<a href="' . zen_href_link($title_link) . '">' . $title . BOX_HEADING_LINKS . '</a>'; } // ?> <!--// bof: <?php echo $box_id; ?> //--> <div class="leftBoxContainer" id="<?php echo str_replace('_', '-', $box_id ); ?>" style="width: <?php echo $column_width; ?>"> <h3 class="leftBoxHeading" id="<?php echo str_replace('_', '-', $box_id) . 'Heading'; ?>"><?php echo $title; ?></h3> <?php echo $content; ?> </div> <!--// eof: <?php echo $box_id; ?> //-->
17 Feb 2016, 11:58 AM
#5
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Warning: Headers already sent

I would also take a look at this extra file: public_html/owa/owa_coreAPI.php on line 1079

To see it is/was doing because it appears that the above template file is fine, but it is outputting code (echo this or that and providing html as well) to the browser, and it may be that the above api is expecting to not have done that yet or to try to apply something that is no longer "permitted" at that point...

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

17 Feb 2016, 1:59 PM
#6
despatchlip avatar

despatchlip

New Zenner

Join Date:
Feb 2016
Location:
UK
Posts:
3
Plugin Contributions:
0

Re: Warning: Headers already sent

Thanks everyone for the replies. I have disabled owa and now no debug reports are being generated.

17 Feb 2016, 2:13 PM
#7
store_support avatar

store_support

New Zenner

Join Date:
Apr 2014
Location:
Polska
Posts:
20
Plugin Contributions:
0

Re: Warning: Headers already sent

:thumbsup: but still its partially solved :P