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 4019) - 03 April 2024

Legacy Cumulus 1 release 1.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 errors / undefined variable / undefined offset

Discussion of Ken True's web site templates

Moderator: saratogaWX

Post Reply
david3
Posts: 63
Joined: Sat 28 Jan 2012 4:03 pm
Weather Station: Davis Vantage Vue
Operating System: Debian 12 64bit for rpi

php errors / undefined variable / undefined offset

Post by david3 »

I was looking through my error.log and noticed the bulk of the errors are these two:

(1846 occurrences)

Code: Select all

[error] 1716#0: *24229 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined variable: Currentsolardescription in /ajax-gizmo.php on line 111" while reading upstream
(80 occurrences)

Code: Select all

[error] 1716#0: *24229 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined offset: 1 in /get-USNO-sunmoon.php on line 158" while reading upstream
They don't seem to affect anything visible; everything seems to be working ok.

Just wondering if there's anything I can do to fix them, to clean things up.

Thanks.
User avatar
saratogaWX
Posts: 1196
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 errors / undefined variable / undefined offset

Post by saratogaWX »

The reason for the Notice: error regarding $Currentsolardescription is because you have no $SITE['conditionsMETAR'] entry in your Settings-weather.php Without that, the variable $Currentsolardescription is not defined. You could use one of these (using the find-metar script on my site for your lat/long)

Code: Select all

$SITE['conditionsMETAR'] = 'RPLC'; // dist=103 mi (166 km), dir=S, Angeles/Pampanga, Philippines elev=196, dated=06-OCT-09
// $SITE['conditionsMETAR'] = 'RPLI'; // dist=106 mi (171 km), dir=N, Laoag Intl(Ph-Ar, Philippines elev=5, dated=06-OCT-09
// $SITE['conditionsMETAR'] = 'RPLB'; // dist=127 mi (205 km), dir=S, Olongapo/Subic, Philippines elev=17, dated=06-OCT-09
// $SITE['conditionsMETAR'] = 'RPLL'; // dist=154 mi (247 km), dir=SSE, Ninoy Aquino Int, Philippines elev=21, dated=06-OCT-09
or change your ajax-gizmo.php from

Code: Select all

$decimalComma = (strpos($temperature,',') !==false)?true:false; // using comma for decimal point?
to

Code: Select all

$decimalComma = (strpos($temperature,',') !==false)?true:false; // using comma for decimal point?
if(!isset($Currentsolardescription)) {$Currentsolardescription = ''; }
For the "PHP Notice: Undefined offset: 1 in /get-USNO-sunmoon.php on line 158", that is caused by a connection issue between your webserver and the aa.usno.navy.mil website. Doing a view-source on your homepage shows
<!-- get-USNO-sunmoon.php - Version 1.02 - 03-Dec-2011 -->
<!-- loading ./cache/USNO-moondata.txt from http://aa.usno.navy.mil/cgi-bin/aa_pap.pl -->
<!-- POST /cgi-bin/aa_pap.pl HTTP/1.1
Host: aa.usno.navy.mil Port: 80 IP=199.211.133.93-->
<!-- Network error: Connection timed out (110) -->
<!-- HTTP stats: dns=0.012 conn=4.005 put=n/a get( blocks)=n/a close=n/a total=4.017 secs -->
<!-- fetch function elapsed= 4 secs. -->
<!-- loading finished. -->
<!-- USNOdata
Array
(
)
-->
which shows a 'Connection time out' at 4 seconds trying to get to aa.usno.navy.mil website.

Hope this helps...

Best regards,
Ken
david3
Posts: 63
Joined: Sat 28 Jan 2012 4:03 pm
Weather Station: Davis Vantage Vue
Operating System: Debian 12 64bit for rpi

Re: php errors / undefined variable / undefined offset

Post by david3 »

Thanks. I made the change to ajax-gizmo.php and that worked.

It looks like my web server's IP address is getting blocked by the aa.usno.navy.mil website. I sent them an email to see if they can unblock it.

Thanks for your help.
Post Reply