Started getting error 500 today

Out of the blue my site started to throw error 500 this morning.
I’m using php8.2

Fatal error : Uncaught TypeError: Unsupported operand types: string + string in /home/weather/public_html/PWS_livedata.php:1437 Stack trace: #0 /home/weather/public_html/PWS_index2.php(30): include() #1 /home/weather/public_html/index.php(38): include(‘…’) #2 /home/weather/public_html/_test.php(17): include(‘…’) #3 {main} thrown in /home/weather/public_html/PWS_livedata.php on line 1437

Interesting…similar thing happened to me too… Weird problem with PHP

I upgraded to v8.3 and the problem went away but that might not be something that’s easy for you to do.

Your website is working OK
Current PHP version is : 8.1.27
Correct data uploaded

Your website is getting a PHP 500 error
Your current PHP version is : 8.1.27 not 8.2

The error is caused by invalid data in the uploaded file.
Is that a realtime.txt file ?

Change line 1437 in PWS_livedata.php from

else { $new = $cu[2] + $cu[25]; ####### 2020-10-01


else { $new = (float) $cu[2] + (float) $cu[25]; ####### 2024-02-01

That way we can see if there are more problems with the data.

This is your data uploaded:
A lot of NULL values for your outside temp/hum
Also the time is not updated and stalled at 19:07

A screenshot comparing the uploads for your two websites

Well, the errors are solved with adepting that line in PWS_livedata.php
The dashboard is loaded correctly

But with temperatures of 17.8 Celsius, which corresponds to 0 Fahrenheit.
→ The NULL values are translated to zero values.
→ The temp-unit in the upload file is set to F.

Succes with trouble-shooting,

Yes, code change solved Error 500.
Thank you a lot Wim!
Will the code change be implemented future updates, or should I make sure maintain this change in my own copy of PWS_livedata.php?

Next challenge, which I have to solve myself, is why my Davis stopped updating :slight_smile:

There will be “pdates”

  1. if there are new found errors in the scripts
  2. if a provider changes its API
  3. if PHP 9.x forces changes

You changed your scrip as the data uploaded is invalid.
That will not happen again in a few years. :grinning: