WXSIM "EWN-style" for php8

Hi there
Have any of you already updated the script to make it executable with php8?
I mount the version php 7.4 and it works, if set for the php 8 it doesn’t work anymore.
many thanks in advance for any comments

I will pm you the link to a version which I tested with 8.0.8 and 8.1.4
Sadly the file is 499Kb too big to post on the forum.
Please do not share the link as my ftp allowance is not infinite.

edit: 2022-05-03 Attached zip which is now small enough to post.
Thanks to @hcorrin :smiley: which pointed me to remove the wret.jpg from the zip.
This image for new users helps to correctly select all needed items.
i will try to post that image later on.

I tested with 8.0.8 and 8.1.4 using 20 different lastret.txt files.
If you run into problems such as not displaying any data ( only the waiting circle is shown)
==> please run in your browser . . /wxsim-ewn/wxsim/_test.php?wunit=kmh&lang=en&test
This will test the data.php script with all errors displayed.
Numerous warnings occur mostly because you not selected the needed items in wret. Ignore those for now.
What i need is the last fatal error at the bottom.
edit: 2022-05-03 end

The location setting of the wxsim file in config.php line 36 should be set first, f.i. for a windows server the full path should be similar to this

$path_to_lastret = 'C:\xampp\htdocs\lastret.txt';

For a linux server

$path_to_lastret = "/Users/xyz/httpdocs/lastret.txt";

Leave line 23 as is for now, it displays the php version after the stations name.
Succes,

Wim


wxsim-ewn.zip (181 KB)

As you decided to use PM’s i can not answer anymore.

Your inbox is FULL.

Again, you should use the forum for questions and answers.
Far better for you and others.

NO, now your lastret.txt has minutes before the hour 2022-05-01_14:58_UTC
What did you change in WXSIM ?

Wim

the file size is due to the wret.jpg which was in the original could it not be removed for the updated files to make the zip smaller

Thanks, I uploaded the test version without the image [color=blue][b]here[/b][/color]

@ALL
This is not my script, i only adapted it to overcome the fatal messages caused by the PHP 8 restrictions.
As this is a large script, written when PHP 5.6 was modern, probably not all PHP 8 new restrictions are tested.
New fatal messages can pop-up
But posting it here will help to find the remaining code-lines to change.

When posting please post the link to your version as I need the correct line where a fatal error occurs.

Wim

i put this on my host https://www.hc-iom.co.uk/wxsim3/forecast.php ready for php version 8 i have options for 8.0 and 8.1 which should i go for
current php version is 7.4 the next update time is doing strange things the update times hours are 3,6,9,12,15,18,21
will let you know when i have upgrade the php

Good evening, I’m trying to start Wxsim-ewn but I can’t get it to display the data. I upload the file “lastret.txt” directly to the server but I can’t get it to display data, only a spin


ning wheel appears.

I checked a dozen or so of your previous posts, but could not find any URL / link to your website.

Well, if you do not post the link to your website and to the EWN page, there is nothing others can do to help you.

Parece que la mayoría de nosotros no somos clarividentes.


I found a link to your site in your screenshot.

Your lastret.txt has minutes before the hour 2024-06-14_07:28_UTC
Your lastret.txt also uses US dates in the first field 7:58a

The EWN scripts needs “on-the_hour” data. As there are no such lines in your last-ret.txt, there is no data to show.

Wim

Thank you very much for your response Mr. Wim, it seems that a Windows update fixed the schedule problem and the data is displayed again.
Even so, I would like to be able to delete the information from the last update that always shows 01/01/1970, can you advise me on how I can fix it?
I use Windows 11 and although my server offers me any PHP version, I am using 7.2

URL “https://badameteo.com/wxsim-ewn/forecast.php
a cordial greeting

Fix:
Check in your wxsim-ewn/wxsim/config.php the setting on line 36

$path_to_lastret = “/User. . . ./lastret.txt”;

That path should be correct.

Delete:
Set line 125 in wxsim-ewn/wxsim/frc.php to comment

       '.UPDATED.': '.date($timeFormat,filemtime($path_to_lastret)).'<br/> 
 <!--      
    '.UPDATED.': '.date($timeFormat,filemtime($path_to_lastret)).'<br/> 
 -->

Thanks, now after the corrections it appears like this.
URL" https://badameteo.com/wxsim-ewn/forecast.php"
I attach a screen print of my “frc.php” on line 125

You asked me to help to delete that line

Seems correct to me. The line with 1-1-1970 is not visible anymore.
As you set that line for “updated” to html-comment it is not shown to the website-visitors anymore. But it is still visible in the html
<!-- Actualizado: 01/01/1970 01:00<br/> -->

To get the correct date/time you have to check the line in wxsim-ewn/wxsim/config.php which sets the location of lastret.txt
It is somewhere around line 36 and should look like
$path_to_lastret = “/User. . . ./lastret.txt”;

Then one can see if that is in- correct and adjust it.

Wim

Hello Wim again, I don’t quite understand the instruction you give me, because if I change something there everything will probably work, it’s probably because I don’t know what /user…/lastret.txt means, I’m attaching an image of the line that tells me.

Hi,

It is fairly difficult to explain.


The script uses a filemtime PHP instruction to get the last modification time of the lastret file.
Currently your are using relative file-addressing which uses …/ or ./ to locate the file
$path_to_lastret = "../../lastret.txt";

But is seems that it does not work correctly with all versions of PHP or web-servers.
Better to use the exact location of the file on your webserver. Then it looks like
$path_to_lastret = "/Users/xyz/Documents/weather/lastret.txt";
But is is tricky to get the correct full path to the file, sometimes one has to ask the webhosting support to help.


So if you are happy with removing that 01/01/1970 line, you should leave the scripts as is.

Have much fun using this script which is written by @weatherc, also known as HENKKA from NordicWeather).

Wim