Welcome to the new home of the Cumulus Support forum.

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

WU-graphs php header problem.

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

Moderators: daj, TNETWeather

Post Reply
User avatar
duke
Posts: 840
Joined: Sun Jul 03, 2011 6:23 pm
Weather Station: Davis VP2 Plus - 24hr FARS
Operating System: Windows 10 - 64 bit
Location: Eastleigh, Hampshire, UK
Contact:

WU-graphs php header problem.

Post by duke » Sun Feb 05, 2012 5:56 pm

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?
Duke

Nightingale Weather
Eastleigh, Hampshire, UK
------------------------------------------------------
Validate your pages - often!

User avatar
beteljuice
Posts: 2504
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: WU-graphs php header problem.

Post by beteljuice » Sun Feb 05, 2012 11:31 pm

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 Feb 01, 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 » Tue Feb 07, 2012 11:16 pm

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: 152
Joined: Wed May 13, 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 » Fri Feb 17, 2012 12:11 am

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?

User avatar
duke
Posts: 840
Joined: Sun Jul 03, 2011 6:23 pm
Weather Station: Davis VP2 Plus - 24hr FARS
Operating System: Windows 10 - 64 bit
Location: Eastleigh, Hampshire, UK
Contact:

Re: WU-graphs php header problem.

Post by duke » Fri Feb 17, 2012 1:26 pm

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
Duke

Nightingale Weather
Eastleigh, Hampshire, UK
------------------------------------------------------
Validate your pages - often!

User avatar
beteljuice
Posts: 2504
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: WU-graphs php header problem.

Post by beteljuice » Fri Feb 17, 2012 1:38 pm

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 !

User avatar
duke
Posts: 840
Joined: Sun Jul 03, 2011 6:23 pm
Weather Station: Davis VP2 Plus - 24hr FARS
Operating System: Windows 10 - 64 bit
Location: Eastleigh, Hampshire, UK
Contact:

Re: WU-graphs php header problem.

Post by duke » Fri Feb 17, 2012 2:36 pm

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
Duke

Nightingale Weather
Eastleigh, Hampshire, UK
------------------------------------------------------
Validate your pages - often!

bigmac
Posts: 152
Joined: Wed May 13, 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 » Sat Feb 18, 2012 12:27 am

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: 54
Joined: Thu Aug 23, 2012 8:53 pm
Weather Station: WH 2080
Operating System: Windows 7
Location: Konin, Poland

Re: WU-graphs php header problem.

Post by Mark14 » Sat Jul 07, 2018 7:58 pm

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

User avatar
saratogaWX
Posts: 903
Joined: Wed May 06, 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 » Sat Jul 07, 2018 8:27 pm

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: 54
Joined: Thu Aug 23, 2012 8:53 pm
Weather Station: WH 2080
Operating System: Windows 7
Location: Konin, Poland

Re: WU-graphs php header problem.

Post by Mark14 » Sun Jul 08, 2018 6:47 am

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();
?>

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

Re: WU-graphs php header problem.

Post by ConligWX » Sun Jul 08, 2018 8:07 am

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

User avatar
mcrossley
Posts: 5209
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: WU-graphs php header problem.

Post by mcrossley » Sun Jul 08, 2018 9:50 am

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: 54
Joined: Thu Aug 23, 2012 8:53 pm
Weather Station: WH 2080
Operating System: Windows 7
Location: Konin, Poland

Re: WU-graphs php header problem.

Post by Mark14 » Sun Jul 08, 2018 10:54 am

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...

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

Re: WU-graphs php header problem.

Post by ConligWX » Sun Jul 08, 2018 11:50 am

Regards Simon

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

Post Reply