Author Topic: mesonet-map.php error  (Read 950 times)

0 Members and 1 Guest are viewing this topic.

Offline xmas111

  • Senior Member
  • **
  • Posts: 65
    • http://www.johnsweather.com
mesonet-map.php error
« on: August 17, 2023, 03:46:38 PM »
Finally decided to get off my butt and up date my meso map web page.

I'm using the stand alone version (mesonet-map.php) and I'm getting this error:  Fatal error: Call to undefined function locale_get_default() in /home/81/77/2937781/web/MESO-MAP/mesonet-map-common.php on line 921
The error message is at the bottom of the page.

This isn't the finished web page yet but here's a link to it: http://johnsweather.com/MESO-MAP/mesonet-map.php


Any suggestions how to fix this error would be greatly appreciated.

Thanks,
John

Offline SteveFitz1

  • Forecaster
  • *****
  • Posts: 519
    • Tyler Texas Weather
Re: mesonet-map.php error
« Reply #1 on: August 17, 2023, 03:53:42 PM »

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: mesonet-map.php error
« Reply #2 on: August 17, 2023, 04:05:10 PM »
The HTTP return headers from your website show "PHP/5.3.29-1+hw8" is the running version of PHP.

That is WAY too old -- you should be running PHP 7+ or PHP 8+ on your site.

The Fatal error means that the built-in PHP function locale_get_default() is not being provided by your PHP installation.  That capability is enabled by --enable-intl  (International Functions) when PHP is configured.

Contact your website hoster to get your PHP updated and the international functions enabled and the mesonet-map will work (tested on PHP 8.2)

 
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 xmas111

  • Senior Member
  • **
  • Posts: 65
    • http://www.johnsweather.com
Re: mesonet-map.php error
« Reply #3 on: August 17, 2023, 04:20:17 PM »
Ken, thank you very much. I will contact my web host and request they update my php to 7 or 8 and enable international functions.

John

Offline xmas111

  • Senior Member
  • **
  • Posts: 65
    • http://www.johnsweather.com
Re: mesonet-map.php error
« Reply #4 on: August 17, 2023, 04:51:16 PM »
Oh boy, my web host updated my php to version 8 but it broke my website so I had to have them put it back to where it was.

Looks like I'll just have to remove the mseo map from my site.....bummer.

Thanks again for your help.

John

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: mesonet-map.php error
« Reply #5 on: August 17, 2023, 05:40:27 PM »
I'm sorry about the update to PHP8 broke your site.  It's a fairly straightforward process to update PHP scripts to be compatible with PHP8:

1) check the error_log for PHP messages
2) fix the script by updating php syntax as needed, upload the fixed script
3) repeat as needed.

Some common fatal errors come from former built-in functions that are now removed:

split() was replaced with explode()

each() was removed so constructs like:

Code: [Select]
while (list($key, $val) = each($array)) {are replaced with
Code: [Select]
foreach ($array as $key => $val) {
Also any 'shortcodes' like:
<?  are replaced with <?php
<?= are replaced with <?php print

depending on your PHP settings, you may get Notice: errata testing undefined variables and fatal errors trying to do arithmetic on strings .. sloppy coding was 'forgiven' in older PHP.. modern PHP (rightly) gripes if the operator types don't match the operands.

You didn't say what exactly broke on your website.  Since you seem to be running VWS, perhaps some old scripts need to be updated?

PHP 5.3 has been off support for over 10 years and is not safe to stay with .. I do urge you to take the plunge to get supported PHP on your website.

BTW, the mesomap.php script for the NEWN was deprecated 4 years ago and replaced with the mesonet-map set of scripts.   The buoy-data script was updated to work with PHP 8.
These scripts may need updates:
/grlevel3/democrop.php
/owa/log.php
/owa/blank.php
/L2K/wxl2k.php
/L2K/L2K.png

atom-advisory.php  (newer version available at https://saratoga-weather.org/atom-advisory.php?sce=view)

I don't see other .php being loaded by your home page that would be broken by a PHP update.
« Last Edit: August 17, 2023, 06:15:18 PM by saratogaWX »
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 xmas111

  • Senior Member
  • **
  • Posts: 65
    • http://www.johnsweather.com
Re: mesonet-map.php error
« Reply #6 on: August 18, 2023, 06:16:00 AM »
Ken,   thank you very much for taking the time to analyze my site and give advice on how to upgrade it to work with php 8.

Although most of this is way over my head I will tinker with it and hopefully get it to work with php 8.

I will report back and let you know how I make out......it will probably be a while before I do.

Thanks again.

John
« Last Edit: August 18, 2023, 06:54:12 AM by xmas111 »

Offline xmas111

  • Senior Member
  • **
  • Posts: 65
    • http://www.johnsweather.com
Re: mesonet-map.php error
« Reply #7 on: August 25, 2023, 02:53:27 PM »
Boy, I got lucky!  Only had to correct one misspelled word in one PHP file and now everything is working with PHP 8.

Here's the MESO-MAP page http://johnsweather.com/MESO-MAP/mesonet-map.php page with no errors.

Thanks for all the help getting my website up and running with PHP 8.

One more quick question, how do I get my website put on the map.  I was on the older version of meso-map.

Thanks,
John

Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1308
  • BismarckWeather.net
    • BismarckWeather.net
Re: mesonet-map.php error
« Reply #8 on: August 25, 2023, 04:09:40 PM »
If Ken doesn't see this post, I think you can fill out this form.

https://saratoga-weather.org/contact.php
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline xmas111

  • Senior Member
  • **
  • Posts: 65
    • http://www.johnsweather.com
Re: mesonet-map.php error
« Reply #9 on: August 25, 2023, 04:26:02 PM »
Thanks, 92merc I just send Ken a message.

John

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: mesonet-map.php error
« Reply #10 on: August 25, 2023, 05:23:15 PM »
Saw the email.. decided to reply here instead.

Your station stopped publishing the VWS_stickertags.htm with fresh data 05-Apr-2023 so I commented out the record in the NorthEast regional site.
I now see you have current data, so your station is back on the NEWN

Congratulations on your working through a PHP upgrade on an older site.. it can be a big pain to update old scripts (some of which may no longer have active maintainers) to keep up with changes in PHP versions.
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