Author Topic: Saratoga Base-* Templates and PHP 8  (Read 883 times)

0 Members and 1 Guest are viewing this topic.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8386
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Saratoga Base-* Templates and PHP 8
« on: December 07, 2020, 10:24:56 PM »
I've done testing with the Base-Canada, Base-USA and Base-World templates and only found two scripts that needed minor updates to run on PHP 8.+ (and still compatible with older PHP versions).

common.php V1.11 and flyout-menu.php V1.09 are now available using the update tool with a query of Base-*, Plugin-* 07-Dec-2020

The remaining support scripts seem to work fine and not cast errata in the error_log.  It's safe to update before you update PHP to 8.0.0 as the fixes were backward compatible to prior PHP5/PHP7.

Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline weatherbee

  • Senior Contributor
  • ****
  • Posts: 182
    • Sherman Ct. Weather
Re: Saratoga Base-* Templates and PHP 8
« Reply #1 on: December 08, 2020, 09:46:59 AM »
Thanks Ken.
I have uploaded new files and they are working fine.
Tom

Offline Otis

  • (aka Paul)
  • Forecaster
  • *****
  • Posts: 670
    • Lake Huron Weather
Re: Saratoga Base-* Templates and PHP 8
« Reply #2 on: December 08, 2020, 09:58:11 AM »
Same here.  [tup]

Davis Vantage Pro2, Serial Data Logger,
WD 10.37S-(b60), VWS V15.00p03, Weatherlink 6.0.3,  Fling 2.35, 7 Pro 64Bit
KMICHEBO10 - CW3699 - Cheboygan, MI

Offline n7xrd

  • Forecaster
  • *****
  • Posts: 361
    • Kamiah Weather
Re: Saratoga Base-* Templates and PHP 8
« Reply #3 on: December 11, 2020, 02:29:43 PM »
     Ken
I am not running PHP 8 yet but did update these 2 files and when the common.php is installed the main page does not display?

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8386
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga Base-* Templates and PHP 8
« Reply #4 on: December 11, 2020, 03:49:10 PM »
What did your error_log on your website say when you had the common.php V1.11 installed and the site malfunctioned? 
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline n7xrd

  • Forecaster
  • *****
  • Posts: 361
    • Kamiah Weather
Re: Saratoga Base-* Templates and PHP 8
« Reply #5 on: December 11, 2020, 03:51:43 PM »
Sorry Ken where would I find the error log?

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8386
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga Base-* Templates and PHP 8
« Reply #6 on: December 11, 2020, 03:52:39 PM »
It would be on your website, likely available on the cPanel controlling the website.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline n7xrd

  • Forecaster
  • *****
  • Posts: 361
    • Kamiah Weather
Re: Saratoga Base-* Templates and PHP 8
« Reply #7 on: December 11, 2020, 03:56:16 PM »
I see lots of access denied by server configuration?

Offline n7xrd

  • Forecaster
  • *****
  • Posts: 361
    • Kamiah Weather
Re: Saratoga Base-* Templates and PHP 8
« Reply #8 on: December 11, 2020, 04:00:18 PM »
access_compat:error

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8386
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga Base-* Templates and PHP 8
« Reply #9 on: December 11, 2020, 04:08:56 PM »
What is the complete error message with common.php cited..   The 'access denied' messages may be just from IP addresses denied by a .htaccess configuration.  If you'll download your error_log and send it to webmaster at saratoga-weather.org via email, I'll take a look.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline n7xrd

  • Forecaster
  • *****
  • Posts: 361
    • Kamiah Weather
Re: Saratoga Base-* Templates and PHP 8
« Reply #10 on: December 11, 2020, 04:50:27 PM »
email sent

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8386
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga Base-* Templates and PHP 8
« Reply #11 on: December 11, 2020, 05:21:09 PM »
Ok, this has error records from 07:50:15 to 14:40:31 today.. no entries about a problem with common.php (no PHP warning or fatal error at all).  When did you try the install?  Last night? If so, install the new common.php again, load your page a couple of times, put the old file back, then send the error_log again to me please.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline n7xrd

  • Forecaster
  • *****
  • Posts: 361
    • Kamiah Weather
Re: Saratoga Base-* Templates and PHP 8
« Reply #12 on: December 11, 2020, 05:50:31 PM »
   Ken I did this and all I see is the line with the clientraw,txt file at the end like in the email I sent with a time of 15:45 as the latest  just loaded the update today!

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8386
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga Base-* Templates and PHP 8
« Reply #13 on: December 11, 2020, 06:14:39 PM »
Ok, please put the V1.11 common.php on your site so I can look at what is generated on your page.  I can't tell what's happening just from your description and the error_log I've seen so far.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8386
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga Base-* Templates and PHP 8
« Reply #14 on: December 11, 2020, 06:26:26 PM »
Nevermind the above.  I found the issue.  You had added
Code: [Select]
// Alternate $changeinday routine that finds $changeinday2
function get_changeinday() {
    global $hrsOfSunLight;
    global $SITE;
    global $displayTomorrow;

    $t = time()-86400; // Yesterday

    for ($i=0; $i<(2+($displayTomorrow?1:0)); $i++) { // Only loop twice if no $displayTomorrow
        $sun = date_sun_info($t, $SITE['latitude' ], $SITE["longitude"]);
        $srise  = $sun["sunrise"];
        $sset  = $sun["sunset"];
        // Now adjust for ST<>DST transitions
//        $stdstOffset[$i] = ((date("I",$t+(86400*$i))!=date("I",$t+(86400*($i+1))))?((date("I",$t+(86400*$i))>date("I",$t+(86400*($i+1))))?3600:-3600):0);
//        $sunhrs[$i] = $sset - $srise + $stdstOffset[$i];   // $sunhrs is time between sunrise and sunset + DST-ST offset
        $sunhrs[$i] = $sset - $srise;   // $sunhrs is time between sunrise and sunset
        $sh[$i] = floor($sunhrs[$i]/3600); // Sun Hours
        $sm[$i] = floor((($sunhrs[$i]/3600)-$sh[$i])*60); // Sun Minutes
        $ss[$i] = round(((((($sunhrs[$i]/3600)-$sh[$i])*60)-$sm[$i])*60),0); // Sun Seconds
        $hrsOfSunLight[$i] = $sh[$i].':'.$sm[$i].':'.$ss[$i]; // Assemble strings in array
        $t+=86400; // Next Day
    }

    $cindsign = (($sunhrs[1]-$sunhrs[0])>0)?'+':'-'; // Change IN Day sign

    $shdiff = ($cindsign=='-'?($sh[0] - $sh[1]):($sh[1] - $sh[0])); // Difference in hours
    $smdiff = ($cindsign=='-'?($sm[0] - $sm[1]):($sm[1] - $sm[0])); // Difference in minutes
    $ssdiff = ($cindsign=='-'?($ss[0] - $ss[1]):($ss[1] - $ss[0])); // Difference in seconds
    if ($ssdiff<0) { // negative number of seconds?
        $smdiff -= 1; // borrow
        $ssdiff += 60; // and carry
    }
    if ($smdiff<0) { // negative number of minutes?
        $shdiff -=1; // borrow
        $smdiff += 60; // and carry
    }
    $changeinday2 = $cindsign.$shdiff.':'.$smdiff.':'.$ssdiff; // Assemble cind string
    return $changeinday2;
}
// end of changeinday()
to common.php V1.10.  That code would need to be added to V1.11 common.php and then uploaded for it to work.  PHP was likely failing with a undefined function for get_changeinday and that's a PHP fatal error.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline n7xrd

  • Forecaster
  • *****
  • Posts: 361
    • Kamiah Weather
Re: Saratoga Base-* Templates and PHP 8
« Reply #15 on: December 11, 2020, 06:26:54 PM »
Pk Ken it is on there now!

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8386
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Saratoga Base-* Templates and PHP 8
« Reply #16 on: December 11, 2020, 06:30:30 PM »
See my post above for the fix to the problem.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Boltek-PCI/NexStorm, microSferics ToA, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge/hub
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline n7xrd

  • Forecaster
  • *****
  • Posts: 361
    • Kamiah Weather
Re: Saratoga Base-* Templates and PHP 8
« Reply #17 on: December 11, 2020, 06:38:09 PM »
  Oh Boy THANK YOU Ken!!   That was it!

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2436
    • SouthEast Lincoln, NE Weather
Re: Saratoga Base-* Templates and PHP 8
« Reply #18 on: December 12, 2020, 06:05:09 AM »
I'm afraid that's my fault, guys.  I added that routine when I needed to have the $changeinday2 available for my menubar rather than just in my alternate dashboard.  The variable is used for the Mark Crossley derived sunlight pie routine.  I know it's there, so when Ken posts a revision to common.php I always use CompareIt to be sure that my mods are incorporated into the latest version.

Sorry about that! :oops:
Regards, Jerry Wilkins
gwwilk@gmail.com