Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

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

Discussion of Ken True's web site templates

Moderator: saratogaWX

User avatar
Toxic17
Posts: 542
Joined: Mon May 19, 2014 10:45 pm
Weather Station: Davis Vantage Pro2 Plus
Operating System: Debian 9.1 Stretch
Location: Bangor, NI
Contact:

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

Postby Toxic17 » Mon Aug 14, 2017 6:34 pm

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
https://twitter.com/conligwx
Davis Vantage Pro2+ - CumulusMX v3.0.0 (build 3043) + Saratoga/PWS
Image

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

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

Postby saratogaWX » Mon Aug 14, 2017 6:53 pm

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
Toxic17
Posts: 542
Joined: Mon May 19, 2014 10:45 pm
Weather Station: Davis Vantage Pro2 Plus
Operating System: Debian 9.1 Stretch
Location: Bangor, NI
Contact:

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

Postby Toxic17 » Mon Aug 14, 2017 7:05 pm

:groan:

Once again, Thanks! :clap:
Regards Simon

https://www.conligwx.org
https://twitter.com/conligwx
Davis Vantage Pro2+ - CumulusMX v3.0.0 (build 3043) + Saratoga/PWS
Image


Return to “Saratoga Templates”

Who is online

Users browsing this forum: No registered users and 2 guests