WXforum.net

Web Weather => Weather Website PHP/AJAX scripting => Custom Website Templates => Topic started by: andro700 on April 27, 2022, 03:28:34 PM

Title: River Page & PHP 8.1
Post by: andro700 on April 27, 2022, 03:28:34 PM
I am having issues with my river page. I have to disable warnings in my php.ini file or the page will not load due to so many errors or it takes a long time to load. It is East Masonville Weather script. I have sent him a email and have not gotten a response.

Quote
[24-Apr-2022 13:32:11 America/Los_Angeles] PHP Warning:  simplexml_load_file(): ./river-LNDW1.txt:1: parser error : Document is empty in /home/goblesweather/www/www/River/river-fetch.php on line 110 
Here is the link to this file   https://www.goblesweather.com/River/river-LNDW1.txt (https://www.goblesweather.com/River/river-LNDW1.txt)    It is not empty.
[24-Apr-2022 13:32:11 America/Los_Angeles] PHP Warning:  simplexml_load_file():  in /home/goblesweather/www/www/River/river-fetch.php on line 110
[24-Apr-2022 13:32:11 America/Los_Angeles] PHP Warning:  simplexml_load_file(): ^ in /home/goblesweather/www/www/River/river-fetch.php on line 110
Here is the line 110
Code: [Select]
$xmlData["$riverid"] = simplexml_load_file($xmlFileData);
I have attached a copy of my river-fetch script.

When I click on any of the links to any river the page is blank.

Chuck

Title: Re: River Page & PHP 8.1
Post by: saratogaWX on April 27, 2022, 03:47:18 PM
You should try the attached update.. it works on PHP 8.1
Title: Re: River Page & PHP 8.1
Post by: drrehak on April 28, 2022, 12:15:23 PM
Are there other files somewhere for a new install?
Looking for river-config.php
Can't tell if river-status.php is needed or created.
Assuming /River/ has to be set for write access.
Anything else needed to setup?

Thanks.
Title: Re: River Page & PHP 8.1
Post by: saratogaWX on April 28, 2022, 12:27:56 PM
Yes, the file I attached just contains the changed files from the last distribution.

Attached is the last full distribution I have .. just overwrite it with the update above and you'll have a complete set.
Title: Re: River Page & PHP 8.1
Post by: gwwilk on April 28, 2022, 01:24:55 PM
Thanks, Ken! [tup] =D> \:D/ =D>

This page hasn't worked for me for quite some time now.  But happily thanks to you it's fixed (https://gwwilkins.org/wxriverpage.php)!

I even remembered to reactivate my 'river-fetch.php' CRONS. :-)
Title: Re: River Page & PHP 8.1
Post by: saratogaWX on April 28, 2022, 04:13:19 PM
You're welcome :)

The last version of the script from eastmasonvilleweather.com was 3.13F in 2015.

I did some fixes in June, 2020 for a 3.13G version, and I've merged in the PHP 8+ fixes for a 3.13H version attached.
Title: Re: River Page & PHP 8.1
Post by: andro700 on June 10, 2022, 10:03:35 AM
I am getting the following errors when I try and run a cron job for the river-fetch.php file. I have the latest H river script. Any clues.

Code: [Select]
/home/goblesweather/www/www/River/river-fetch.php: line 1: ?php
: No such file or directory
/home/goblesweather/www/www/River/river-fetch.php: line 14: syntax error near unexpected token `"river-config.php"'
/home/goblesweather/www/www/River/river-fetch.php: line 14: `include("river-config.php");
'

Chuck
Title: Re: River Page & PHP 8.1
Post by: saratogaWX on June 10, 2022, 01:47:56 PM
I'm not sure what cron command you are using, but you need to run the PHP interpreter and pass it the river-fetch.php file.
It looks like (based on the error message, you're just trying to run the river-fetch.php file directly.

Your cron command should look like:

Code: [Select]
/usr/local/php81/bin/php -q /home/goblesweather/www/www/River/river-fetch.php
Title: Re: River Page & PHP 8.1
Post by: andro700 on June 10, 2022, 05:41:53 PM
I will check it out. I am running the cron job via my web host.

Chuck
Title: Re: River Page & PHP 8.1
Post by: andro700 on June 12, 2022, 02:55:15 PM
I got it working using Curl and System Scheduler. Don't know why I didn't think of this way sooner. Much less headache than trying to figure cron jobs on my web host site.

Chuck