Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4017) - 17 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

PHP Warning: Cannot modify header information - headers already sent by

Discussion of Ken True's web site templates

Moderator: saratogaWX

Post Reply
User avatar
ConligWX
Posts: 1570
Joined: Mon 19 May 2014 10:45 pm
Weather Station: Davis vPro2+ w/DFARS + AirLink
Operating System: Ubuntu 22.04 LTS
Location: Bangor, NI
Contact:

PHP Warning: Cannot modify header information - headers already sent by

Post by ConligWX »

Ken,

thought I would bring this to your attension, though not sure if anyone else actually gets this error message themselves, I would guess most do not look at error logs on their webserver :)

Lately I have noticed many errors listed like so:

Code: Select all

[Mon Aug 14 12:10:34.811473 2017] [php7:warn] [pid 3401:tid 140485525542656] [client xx.xxx.xxx.xx:50973] PHP Warning:  Cannot modify header information - headers already sent by (output started at /share/xxxxxx/xxxxx/top.php:146) in /share/xxxxxx/xxxxx/htdocs/weather/header.php on line 34
I've tried searching to answer but most I do not understand.

one however showed the following..


Source: https://stackoverflow.com/questions/802 ... ror-in-php
Typical causes:

Print, echo

Intentional output from print and echo statements will terminate the opportunity to send HTTP headers. The application flow must be restructured to avoid that. Use functions and templating schemes. Ensure header() calls occur before messages are written out.

Functions that produce output include

print, echo, printf, vprintf
trigger_error, ob_flush, ob_end_flush, var_dump, print_r
readfile, passthru, flush, imagepng, imagejpeg

among others and user-defined functions.
the error I shows has on line 146: print $FlyoutCSS;

So is this could possibly an issue with my PHP 7.1.8 and Apache 2.4.27 setup perhaps?

I'm really just curious as on the website it appears everything is working fine.
Regards Simon

https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir •

Image
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: PHP Warning: Cannot modify header information - headers already sent by

Post by saratogaWX »

Your header.php has a line

Code: Select all

header('Content-Type: text/html; charset=utf-8');
that is not in the distributed header.php .. that's what is causing the extra warning statement.

In the template, the character set is established by top.php with

Code: Select all

//Version  V3.04 - 05-Feb-2013 - added support for HTML5+UTF8
############################################################################
if(isset($useUTF8) and function_exists('set_langtrans_UTF8') ) {
	set_langtrans_UTF8(); // convert langrans items to UTF-8
}
header("Content-Type: text/html; charset=".strtoupper($SITE['charset']));
to support the multiple languages with different character sets.
User avatar
ConligWX
Posts: 1570
Joined: Mon 19 May 2014 10:45 pm
Weather Station: Davis vPro2+ w/DFARS + AirLink
Operating System: Ubuntu 22.04 LTS
Location: Bangor, NI
Contact:

Re: PHP Warning: Cannot modify header information - headers already sent by

Post by ConligWX »

:groan:

Once again, Thanks! :clap:
Regards Simon

https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir •

Image
Post Reply