How to get WXSIM EWN-style scripts working under PHP5.3

Recently I got my WXSIM version customized by Tom and I wanted to use the EWN-style WXSIM-forecast scripts downloaded from NordicWeather (from 03-2017).
I am running my website on a Synology NAS with an old PHP5.3 version.
The WXSIM saratoga and Leuven scripts needed only configuration but to get the EWN-style scripts finally running I had to do the following:

  1. debug with browser URL …/wxsim-ewn/wxsim/_test.php?wunit=kmh&lang=en&test

  2. to be able to read the lastret.txt file I had to use an absolute path in config.php:
    $path_to_lastret = “http://leonas.ddns.net/Wetterstation.Suttenbrunn.CumulusMX/lastret.txt”;
    the relative path #path_to_lastret = “…/lastret.txt”; did not work
    although for the rest of the paths I could use relative path names:
    $path_to_langfiles = “./wxsim/”;
    $path_to_dataphp = “./wxsim/”;
    $path_to_js = “./js/”;
    $path_to_css = “./css/”;

  3. on the other hand to avoid a display of 01.01.1970 I had to use an relative path in script frc.php:
    ‘.UPDATED.’: ‘.date($timeFormat,filemtime(“…/lastret.txt”)).’

  4. to display a correct “next Update” I adapted the following line in frc.php:
    $thishr = date(‘H’); (replacing ‘i’ by ‘H’)

  5. and finally I had to adapt the sunmoon.php script to run under PHP5.3:
    a) replacing brackets by array () in some locations and
    b) harcoding the timezone in
    function fromJulian($j) {
    if (!is_nan($j))
    {
    $dt = new DateTime(“@”.round(($j + 0.5 - J1970) * daySec));
    $dt->setTimezone(new DateTimeZone(‘Europe/Amsterdam’));
    return $dt;
    }
    }

Now the EWN-style interpretation of my WXSIM forecast is working fine under URL:

If somebody is interested I could upload/attach the modified php scripts.
regards
leo

and 6) take care that timestamps in lastret.txt are multiples of whole or half hour: 20:00, 20:30, 21:00, …
and not 19:50, 20:20, …
so that parsing of the file with data.php does not get interrupted

this can either be achieved automatically during WXSIMATE/WXSIM import (e.g. when also importing local data) or by adjusting Time Field in WXSIM main screen after import before starting the forecast calculation.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.