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

WU-graphs php header problem.

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

Post Reply
duke

WU-graphs php header problem.

Post by duke »

I guess this problem is aimed at the PHP gurus ;) .

I have WU-graphs running as "stand alone" here:http://www.nightingaleweather.co.uk/wugraphs.php.

But when I use include on a page where I want it I get this:
Warning: Cannot modify header information - headers already sent by (output started at /home/*********/public_html/template101.php:15) in /home/night239/public_html/wugraphs.php on line 35

Warning: Cannot modify header information - headers already sent by (output started at /home/*********/public_html/template101.php:15) in /home/night239/public_html/wugraphs.php on line 44

Warning: Cannot modify header information - headers already sent by (output started at /home/*********/public_html/template101.php:15) in /home/night239/public_html/wugraphs.php on line 45

Warning: Cannot modify header information - headers already sent by (output started at /home/*********/public_html/template101.php:15) in /home/night239/public_html/wugraphs.php on line 46
Page is here:http://www.nightingaleweather.co.uk/template101.php

It produces one of these every time there is "<?php".

For example, the one above is line 15 in template101.php which is include cumulustags. If I delete this from template101 it does the same on the next "<?php" which is header and so on right down to the footer and including itself :roll:
<?php
include("wugraphs.php");
?>
I also placed it on an empty page and the same result: http://www.nightingaleweather.co.uk/template105.php
Warning: Cannot modify header information - headers already sent by (output started at /home/*******/public_html/template105.php:11) in /home/night239/public_html/wugraphs.php on line 35
The line 11 here where it fails is its own <?php.
<?php
include("wugraphs.php");
?>
So what is going on?
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: WU-graphs php header problem.

Post by beteljuice »

Without actually seeing both your template code and / or delving into the WU-Graphs code, I would hazard the guess that there is an 'include' or 'stand-alone' option.

You would seem to have the stand-alone option but trying to use it as an include. - I think
Image
......................Imagine, what you will KNOW tomorrow !
woodmill
Posts: 2
Joined: Wed 01 Feb 2012 12:16 pm
Weather Station: Fine Profile Wireless
Operating System: Window 7 Pro / Centos5
Location: Woodmill, Southampton, UK
Contact:

Re: WU-graphs php header problem.

Post by woodmill »

Whenever I get

Warning: Cannot modify header information - headers already sent

errors in php they are usually caused by characters getting through to the browser before php sends its headers. This is often due to spurious spaces before an opening <?php tag in one of your includes.

Hope this helps.
bigmac
Posts: 159
Joined: Wed 13 May 2009 9:35 am
Weather Station: Davis Vantage Pro 2 Wireless
Operating System: Raspbian wheezy
Location: Nr Ilkley, West Yorks, UK
Contact:

Re: WU-graphs php header problem.

Post by bigmac »

I was looking on your website and it looks like you resolved your problem.
I have been trying to do something similar based on Jacque's Sunny Weather template.
So, to point me in the right direction, as I'm trying to get to grips with PHP in a simple form, do you just "call" the wugraphs.php page from within another PHP page using the include statement you've detailed above?
And what was the final reason for the problem?
Hope you can help?
duke

Re: WU-graphs php header problem.

Post by duke »

All I've done to get it working is to "include" as above and then simply edit out each line that produces an error. I think there are about 10 lines on the WUGraphs page and 3 in the config. If you simply upload it to your site and go to the page you "include", the errors will be listed with the line number you need to edit out. Better still use XAMPP.

I shall be revisiting this page soon and I am told the best way is not to include but to basicly cut and paste the wugraphs to the page where you want them and play with it from there.

Hope this helps.

Duke
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: WU-graphs php header problem.

Post by beteljuice »

See my earlier post - there is a 'flag' to set to say you are using it as include, otherwise it tries to create a stand-alone page with its own headers in the page you've already got headers for !
Image
......................Imagine, what you will KNOW tomorrow !
duke

Re: WU-graphs php header problem.

Post by duke »

there is a 'flag' to set to say you are using it as include,
This was already set to "true" for include mode and did not resolve my problems. The only way for me to get this to work was "//".

Just in case I got it wrong before, just tried again with the same problem. if you want to try "include = true" I think it's line 363 in WUGsettings.

Duke
bigmac
Posts: 159
Joined: Wed 13 May 2009 9:35 am
Weather Station: Davis Vantage Pro 2 Wireless
Operating System: Raspbian wheezy
Location: Nr Ilkley, West Yorks, UK
Contact:

Re: WU-graphs php header problem.

Post by bigmac »

Thanks Duke and Beteljuice, won't get to try this out until next week sometime, but thanks for the advice.
I'll see how it pans out and come back for more guidance if needs be.
Mark14
Posts: 79
Joined: Thu 23 Aug 2012 8:53 pm
Weather Station: Ecowitt HP3501
Operating System: Windows 10
Location: Konin, Poland

Re: WU-graphs php header problem.

Post by Mark14 »

I have the same problem with WU-graphs after transferring my website on another server: http://serwer1823145.home.pl/wugraphs.php
However, I cannot find empty rows. Could you explain me more precisely how to solve it?

I have the following warnings:

Code: Select all

Warning: Cannot modify header information - headers already sent by (output started at /wxwugraphs/WUG-settings.php:1) in /wxwugraphs/WUG-settings.php on line 363

Warning: PHP Startup: Cannot send session cache limiter - headers already sent (output started at /wxwugraphs/WUG-settings.php:1) in /wxwugraphs/WUG-settings.php on line 506

Warning: Cannot modify header information - headers already sent by (output started at /wxwugraphs/WUG-settings.php:1) in /wugraphs.php on line 54
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: WU-graphs php header problem.

Post by saratogaWX »

The first error message:

Warning: Cannot modify header information - headers already sent by (output started at /wxwugraphs/WUG-settings.php:1) in /wxwugraphs/WUG-settings.php on line 363

Give a big indication of where the problem lies: output started at /wxwugraphs/WUG-settings.php:1

Your WUG-settings.php file likely has a blank line or a space before the <?php at the beginning. Remove that and the warnings will likely cease.
Mark14
Posts: 79
Joined: Thu 23 Aug 2012 8:53 pm
Weather Station: Ecowitt HP3501
Operating System: Windows 10
Location: Konin, Poland

Re: WU-graphs php header problem.

Post by Mark14 »

That's how I understand it, but there is no any blank line in the first row :

http://serwer1823145.home.pl/wxwugraphs ... ttings.php

First 50 lines:

Code: Select all

<?php
################################################################################
# All WUG pages are in UTF-8 format !!!!
# do not edit this and other files in Windows notepad - This file must be without a BOM
# more info eg: http://htmlpurifier.org/docs/enduser-utf8.html#migrate-editor
# For editing you can try eg: http://www.pspad.com
# or http://notepad-plus-plus.org 
################################################################################
/**
 * Project:   WU GRAPHS
 * Module:    WUG-settings.php 
 * Copyright: (C) 2010 Radomir Luza
 * Email: luzar(a-t)post(d-o-t)cz
 * WeatherWeb: http://pocasi.hovnet.cz   
 * 
 * MORE INFORMATION AT:
 * http://pocasi.hovnet.cz/wxwug.php?lang=en    
 *  
 * 
 */
# All included php files is under the terms of GNU license.
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.        
##################################################################################
# begin settings                                                                 #
##################################################################################
## STATION NAME 
// This text will be displayed under the name of the chart.
// For a different name in another language, please fill in the name of the station in the language file.
$stationName = 'Stacja Półwiosek Stary'; // This can be also changed for each language in translation files.

## Year, Month and day when the station started sending data
$sinceY = '2012'; // year format yyyy 
$sinceM = '8'; // month without leading zero
$sinceD = '18'; // day without leading zero

### GRAPH DATA SOURCE ###
$dataSource = 'wunderground'; // 'mysql' - weather display mysql database ; 'wunderground' - wunderground server ; 'wutowdmysql' - combined WU->WD MySQL

# If is set $datasource to 'wutowdmysql' you must set start date when the station started sending data to WD MySQL database
The file ends with:

Code: Select all

if ($_GET['config']) {
  header('Location: '.$mainDir.'configurator.php');  
}

session_start();
?>
Image
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: WU-graphs php header problem.

Post by ConligWX »

looks like you have plenty to update on that site too:

http://serwer1823145.home.pl/check-fetc ... w=versions
Regards Simon

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

Image
User avatar
mcrossley
Posts: 12685
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: WU-graphs php header problem.

Post by mcrossley »

Mark14 wrote:That's how I understand it, but there is no any blank line in the first row :
Did you check for a BOM character? Files need to be saved without a BOM.
Mark14
Posts: 79
Joined: Thu 23 Aug 2012 8:53 pm
Weather Station: Ecowitt HP3501
Operating System: Windows 10
Location: Konin, Poland

Re: WU-graphs php header problem.

Post by Mark14 »

Thank you for your help, guys.

Indeed, there was a BOM character in the file, I installed the TextPad and saved file without UNICODE BOM.

According to the advice I updated the template, apart from thermometer.php because I like more the colourful scale :)

However, another warning emerged when I updated get-USNO-sunmoon.php:

Code: Select all

Warning: Invalid argument supplied for foreach() in /get-USNO-sunmoon.php on line 360

Warning: Invalid argument supplied for foreach() in /get-USNO-sunmoon.php on line 371
What is wrong? I didn't make any changes in this file...
Image
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: WU-graphs php header problem.

Post by ConligWX »

Regards Simon

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

Image
Post Reply