Author Topic: Help with Migration to PHP 8+  (Read 320 times)

0 Members and 1 Guest are viewing this topic.

Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 325
    • Indian Trail Weather
Help with Migration to PHP 8+
« on: February 25, 2024, 07:33:18 AM »
I’m currently migrating from PHP 7.4 to PHP 8+ and need help with the “alternative” ajax-dashboard. script originally published by Scott. If you are utilizing a version of the “alternative” ajax-dashboard and have moved to PHP 8+ …

    1) What version of the ajax-version are you running?
    2) What changes did you make to transition to the PHP 8+ version?

My current dashboard has many customized additions and any assistance that you might be able to offer would be greatly appreciated.

Thanks.
Jeff
indiantrailweather.com
« Last Edit: February 25, 2024, 02:06:44 PM by Breezy »
Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline Vasco

  • Forecaster
  • *****
  • Posts: 343
    • PWS
Re: Help with Migration to PHP 8+
« Reply #1 on: February 25, 2024, 07:40:37 AM »
Latest version for PHP 8+ available here: Saratoga-Weather.org - Legacy Scripts

Ecowitt GW1102 (with GW2000) + Weather Display in Windows 10

Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 325
    • Indian Trail Weather
Re: Help with Migration to PHP 8+
« Reply #2 on: February 25, 2024, 09:01:59 AM »
Thanks. Will look into the detail. A good starting point.
Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9298
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Help with Migration to PHP 8+
« Reply #3 on: February 25, 2024, 07:18:13 PM »
For an older, heavily modified ajax-dashboard.php, the key things to modify are likely:

1) replace all
Quote
${variablename}
with
Quote
{$variablename}
2) replace all
Quote
split(...)
with
Quote
explode(...)
3) there are multiple variables that had null string instead of null arrays.  Check the error message and change
Quote
$variable ='';
to
Quote
$variable = array();
for those variables so used, change
Quote
if($variable == '')
to
Quote
if(!isset($variable[0])
4) some variables weren't initialized with a value before being used.. insert
Quote
$variable = '';
for strings and
Quote
$variable = array();
for arrays.

But.. Vasco has the best advice.. start with the current 6.95h version and do your mods there.  Be sure to replace the four other PHP support scripts in the .zip too -- they all work with PHP 8+.
Good luck.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 325
    • Indian Trail Weather
Re: Help with Migration to PHP 8+
« Reply #4 on: February 26, 2024, 08:16:36 AM »
Ken,

Do these 2 files also need to be edited and uploaded.

    ajaxWDwx3.js
    AltAjaxDashboardConfig6.php

Great information. Thank you Ken.

Much appreciated!  \:D/

Jeff
« Last Edit: February 26, 2024, 09:28:06 AM by Breezy »
Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D