Author Topic: "3in1" Script won't run with PHP version 7.1 - RESOLVED  (Read 622 times)

0 Members and 1 Guest are viewing this topic.

Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 305
    • Indian Trail Weather
"3in1" Script won't run with PHP version 7.1 - RESOLVED
« on: February 12, 2018, 08:37:07 AM »
I tried upgrading from PHP 5.6 to PHP 7.1 (GoDaddy). When running the "3in1" script http://indiantrailweather.com/wx3in1.php the "description and notes" section in the "Overview" tab display "blank". Any ideas as to what I should check? All of the other page scripts on my site process fine using PHP 7.1. All Saratoga files are current. Please note that I'm using the modified 6.92 version Saratoga dashboard and corresponding ajax file. 

Thank you.

Update: Reverted back to PHP 5.6 until I can find a solution.
« Last Edit: February 12, 2018, 03:18:22 PM by Breezy »
Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline Toxic

  • Senior Contributor
  • ****
  • Posts: 244
  • #conligwx
    • conligwx.org
Re: "3in1" Script won't run with PHP version 7.1
« Reply #1 on: February 12, 2018, 09:21:10 AM »
You will probably find the code used to generate the description/notes is calling a command that is deprecated.  Best to find out what commands have been removed since 7.1 from 5.6 here:

http://php.net/manual/en/migration71.php

and

http://php.net/manual/en/migration70.php

then check the wx3in1.php for any code that is not 7.1 compatible and change them accordingly.  without the source code (wx3in1.php) I doubt anyone could help unless they run a similar page and already have that script running on 7.1

sorry I cannot be of more help however.
« Last Edit: February 12, 2018, 09:23:45 AM by Toxic »

Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 305
    • Indian Trail Weather
Re: "3in1" Script won't run with PHP version 7.1
« Reply #2 on: February 12, 2018, 09:27:27 AM »
Thanks for the tool migration link. I'll review it later today. Hopefully I'll learn "how to" use the tool for the script.

Much appreciated!  :grin:
Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline CNYWeather

  • Forecaster
  • *****
  • Posts: 2155
  • Yeah, I'm hugging my traffic light.
    • http://www.cnyweather.com
Re: "3in1" Script won't run with PHP version 7.1
« Reply #3 on: February 12, 2018, 09:27:42 AM »
I tried upgrading from PHP 5.6 to PHP 7.1 (GoDaddy). When running the "3in1" script http://indiantrailweather.com/wx3in1.php the "description and notes" section in the "Overview" tab display "blank". Any ideas as to what I should check? All of the other page scripts on my site process fine using PHP 7.1. All Saratoga files are current. Please note that I'm using the modified 6.92 version Saratoga dashboard and corresponding ajax file. 

Thank you.

Update: Reverted back to PHP 5.6 until I can find a solution.

Jeff, how did you get the option to upgrade to PHP7.x with GoDaddy? In my domain manager I see i'm on 5.6 but only other option is to got back to 5.4
Tony


Offline PaulMy

  • Forecaster
  • *****
  • Posts: 3999
    • KomokaWeather
Re: "3in1" Script won't run with PHP version 7.1
« Reply #4 on: February 12, 2018, 09:38:23 AM »
@Tony,
Are you on cPanel?
Before I changed to cPanel all I could get with GoDaddy was up to 5.6.  Now with cPanel I can go to 7.x but haven't done that yet.

Enjoy,
Paul


Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 305
    • Indian Trail Weather
Re: "3in1" Script won't run with PHP version 7.1
« Reply #5 on: February 12, 2018, 09:38:33 AM »
It just shows in the drop down php versions in the cpanel. Both 7.0 and 7.1

Sent from my BLN-L24 using Tapatalk

Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1243
    • Support site Leuven Template and scripts
Re: "3in1" Script won't run with PHP version 7.1
« Reply #6 on: February 12, 2018, 10:25:14 AM »
I tried upgrading from PHP 5.6 to PHP 7.1 (GoDaddy). When running the "3in1" script http://indiantrailweather.com/wx3in1.php the "description and notes" section in the "Overview" tab display "blank". Any ideas as to what I should check? All of the other page scripts on my site process fine using PHP 7.1. All Saratoga files are current. Please note that I'm using the modified 6.92 version Saratoga dashboard and corresponding ajax file. 

Thank you.

Update: Reverted back to PHP 5.6 until I can find a solution.
This is the only  php7.x error I could find and it occurs in wxall.plaintext.php
Quote
<b>Warning</b>:  preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in
<b>/. . . . . /wxsim_wxall/wxall.plaintext.php</b> on line <b>481</b><br />
As this is a subset of Ken True's plaintext parser you can not use the updated Saratoga  version instead.
This is the line 481-483 in the original downloaded version in wxall.plaintext.php, scan your version of the script to find it.
Code: [Select]
$fixedtxt = preg_replace('!\.\s+([a-z])!es',"'.  ' . strtoupper('\\1')",$fixedtxt);
  $wxalltext[$i] = $fixedtxt;
} # EOF own loop
Just set that first line to comment and all data will be displayed with php7 also.  Maybe an extra linefeed or other small formatting problem will  occur.
Code: [Select]
#   $fixedtxt = preg_replace('!\.\s+([a-z])!es',"'.  ' . strtoupper('\\1')",$fixedtxt);
  $wxalltext[$i] = $fixedtxt;
} # EOF own loop
Or you could try this replacement for the preg_replace with should do the trick also. But that preg_replace/call_back  is Ken True's speciality, ask him if it does not work as expected.
Code: [Select]
#   $fixedtxt = preg_replace('!\.\s+([a-z])!es',"'.  ' . strtoupper('\\1')",$fixedtxt);
$fixedtxt = preg_replace_callback('/([.!?])\s*(\w)/',
     create_function('$matches', 'return strtoupper($matches[0]);'), $fixedtxt);
  $wxalltext[$i] = $fixedtxt;
} # EOF own loop

Wim
« Last Edit: February 12, 2018, 10:31:30 AM by wvdkuil »
Vantage VUE with a WLIP connected to a Meteobridge used for https://weer.sluispark.be/
Same VUE+WLIP uploads to WL.com(2.0)  used for https://sluispark.be/weather28/
Vantage VP2 with a USB logger/Meteobridge for https://www.weerstation-herent.be/
Envoy with a WLIP uploads to WL.com(1.0) as a backup / test for the same site.

Offline CNYWeather

  • Forecaster
  • *****
  • Posts: 2155
  • Yeah, I'm hugging my traffic light.
    • http://www.cnyweather.com
Re: "3in1" Script won't run with PHP version 7.1
« Reply #7 on: February 12, 2018, 02:01:53 PM »
@Tony,
Are you on cPanel?
Before I changed to cPanel all I could get with GoDaddy was up to 5.6.  Now with cPanel I can go to 7.x but haven't done that yet.

Enjoy,
Paul

I have Economy Web Hosting. Guess i'd need the Deluxe Hosting Plan?
Tony


Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 305
    • Indian Trail Weather
Re: "3in1" Script won't run with PHP version 7.1
« Reply #8 on: February 12, 2018, 02:11:42 PM »
Tony,

I have the Economy Linux Hosting with cPanel plan.
Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 305
    • Indian Trail Weather
Re: "3in1" Script won't run with PHP version 7.1
« Reply #9 on: February 12, 2018, 02:13:45 PM »
Wim,

Quote
Or you could try this replacement for the preg_replace with should do the trick also. But that preg_replace/call_back  is Ken True's speciality, ask him if it does not work as expected.

Neither option solved the problem Maybe Ken can offer a suggestion. Thank you for responding.
Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline CNYWeather

  • Forecaster
  • *****
  • Posts: 2155
  • Yeah, I'm hugging my traffic light.
    • http://www.cnyweather.com
Re: "3in1" Script won't run with PHP version 7.1
« Reply #10 on: February 12, 2018, 02:32:59 PM »
Tony,

I have the Economy Linux Hosting with cPanel plan.

Guess i'll have to see why I dont have that option. Thanks Jeff.
Tony


Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 305
    • Indian Trail Weather
Re: "3in1" Script won't run with PHP version 7.1
« Reply #11 on: February 12, 2018, 02:38:37 PM »
Quote
then check the wx3in1.php for any code that is not 7.1 compatible and change them accordingly.  without the source code (wx3in1.php) I doubt anyone could help unless they run a similar page and already have that script running on 7.1

How should I go about checking for compatibility? Can I run a scan or do I search for specific code using the "find" option in the editor?
Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1243
    • Support site Leuven Template and scripts
Re: "3in1" Script won't run with PHP version 7.1
« Reply #12 on: February 12, 2018, 02:38:44 PM »
Wim,

Quote
Or you could try this replacement for the preg_replace with should do the trick also. But that preg_replace/call_back  is Ken True's speciality, ask him if it does not work as expected.

Neither option solved the problem Maybe Ken can offer a suggestion. Thank you for responding.
That is very strange.
Commenting line 481 removes the only php 7.x error in the latest version of the scripts.
I downloaded a fresh copy and tested at with a php 7.1.12 server.

If you post your version of wxall.plaintext.php as wxall.plaintext.php.txt , I can compare it and see if there are any other offending lines in your version.

Wim


Vantage VUE with a WLIP connected to a Meteobridge used for https://weer.sluispark.be/
Same VUE+WLIP uploads to WL.com(2.0)  used for https://sluispark.be/weather28/
Vantage VP2 with a USB logger/Meteobridge for https://www.weerstation-herent.be/
Envoy with a WLIP uploads to WL.com(1.0) as a backup / test for the same site.

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1243
    • Support site Leuven Template and scripts
Re: "3in1" Script won't run with PHP version 7.1
« Reply #13 on: February 12, 2018, 02:41:45 PM »
Quote
then check the wx3in1.php for any code that is not 7.1 compatible and change them accordingly.  without the source code (wx3in1.php) I doubt anyone could help unless they run a similar page and already have that script running on 7.1

How should I go about checking for compatibility? Can I run a scan or do I search for specific code using the "find" option in the editor?
No, but sett all error checking on, and the error messages will tell you were to look.
Change line 3 in wxall.settings.php from
Code: [Select]
#ini_set('display_errors', '0'); to
Code: [Select]
ini_set('display_errors', 'On');   error_reporting(E_ALL & ~E_NOTICE);Wim
Vantage VUE with a WLIP connected to a Meteobridge used for https://weer.sluispark.be/
Same VUE+WLIP uploads to WL.com(2.0)  used for https://sluispark.be/weather28/
Vantage VP2 with a USB logger/Meteobridge for https://www.weerstation-herent.be/
Envoy with a WLIP uploads to WL.com(1.0) as a backup / test for the same site.

Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 305
    • Indian Trail Weather
Re: "3in1" Script won't run with PHP version 7.1
« Reply #14 on: February 12, 2018, 02:45:41 PM »
Wim,

Here is the code ...

Thank you!
Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 305
    • Indian Trail Weather
Re: "3in1" Script won't run with PHP version 7.1
« Reply #15 on: February 12, 2018, 02:52:07 PM »
Quote
No, but sett all error checking on, and the error messages will tell you were to look.
Change line 3 in wxall.settings.php from

I turned error reporting "on" but there are no errors listed when I open the page.
Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1243
    • Support site Leuven Template and scripts
Re: "3in1" Script won't run with PHP version 7.1
« Reply #16 on: February 12, 2018, 02:53:43 PM »
Quote
No, but sett all error checking on, and the error messages will tell you were to look.
Change line 3 in wxall.settings.php from

I turned error reporting "on" but there are no errors listed when I open the page.
The script you sent me, does not have any changes.
Setting error reporting on should display errors also.

Are you running the scripts from another folder, compared to the one you are making the changes into,
maybe wx3in1_42/?

Wim
« Last Edit: February 12, 2018, 02:55:33 PM by wvdkuil »
Vantage VUE with a WLIP connected to a Meteobridge used for https://weer.sluispark.be/
Same VUE+WLIP uploads to WL.com(2.0)  used for https://sluispark.be/weather28/
Vantage VP2 with a USB logger/Meteobridge for https://www.weerstation-herent.be/
Envoy with a WLIP uploads to WL.com(1.0) as a backup / test for the same site.

Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 305
    • Indian Trail Weather
Re: "3in1" Script won't run with PHP version 7.1
« Reply #17 on: February 12, 2018, 03:00:14 PM »
Perhaps ... Let me try your "fixes" in the "wx3in1_42" folder ...  I'll report back.

Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 305
    • Indian Trail Weather
Re: "3in1" Script won't run with PHP version 7.1
« Reply #18 on: February 12, 2018, 03:08:04 PM »
Wim,

That did it!!!!!!!!  \:D/    Your "first" suggested fix worked. Commented out "#" the first line. The file was in the "wx3in1_42" folder. To the best
of my knowledge everything on my site is running now using PHP 7.1.

Thank you very much for the your great support and your great script!!!   =D&gt;
« Last Edit: February 12, 2018, 03:10:42 PM by Breezy »
Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1243
    • Support site Leuven Template and scripts
Re: "3in1" Script won't run with PHP version 7.1
« Reply #19 on: February 12, 2018, 03:14:06 PM »
Wim,

That did it!!!!!!!!  \:D/    Your "first suggested fix worked. commented out "#" in the first line. The file was in the wx3in1_42" folder. To the best
of my knowledge everything on my site is running now using PHP 7.1.

Thank you very much for the your great support and your great script!!!   =D&gt;
Thanks for your remarks, but this is NOT my script. The author is Henkka and this and other fine scripts can be found on  his website  https://www.nordicweather.net/phpscripts.php?en
His name on this forum is weatherc,
And he is also the thriving force at EWN = European Weather Network at https://euweather.eu/

Succes, Wim
Vantage VUE with a WLIP connected to a Meteobridge used for https://weer.sluispark.be/
Same VUE+WLIP uploads to WL.com(2.0)  used for https://sluispark.be/weather28/
Vantage VP2 with a USB logger/Meteobridge for https://www.weerstation-herent.be/
Envoy with a WLIP uploads to WL.com(1.0) as a backup / test for the same site.

Offline Breezy

  • Indian Trail Weather
  • Forecaster
  • *****
  • Posts: 305
    • Indian Trail Weather
Re: "3in1" Script won't run with PHP version 7.1
« Reply #20 on: February 12, 2018, 03:17:16 PM »
Ooops. I stand corrected. My Bad ...  :oops:

Thanks for the great script Henkka and Wim for the fix...
Jeff

W7-64, Intel Z170A 16 GB RAM
Davis VP2 Plus, Davis Soil Moisture/Temp Sensors, Laser Snow Depth Sensor LR4/Fluke 414D

Offline meteothes.gr

  • meteothes.gr Administrator
  • Member
  • *
  • Posts: 22
    • Weather Live! at Thessaloniki Historical Center
Re: "3in1" Script won't run with PHP version 7.1 - RESOLVED
« Reply #21 on: March 12, 2018, 06:15:08 AM »
A few days ago, I upgraded server's PHP from 5.6 to 7.1.

That's a major upgrade, so many issues appeared as expected! Most of them have been resolved,
but there's one in wxsim 3in1 script that I can't:

Europe/Athens] PHP Warning:  Invalid argument supplied for foreach() in /home/thanos/public_html/wxsim_wxall/wxall.lastret.php on line 375
[12-Mar-2018 10:55:49 Europe/Athens] PHP Warning:  reset() expects parameter 1 to be array, null given in /home/thanos/public_html/wxsim_wxall/wxall.lastret.php on line 374


This error message does not appear on the page, but is recorded in my system's error_log file in root.

Error display is on in config file: (ini_set('display_errors', '1');)

The page looks to be running fine: 

http://www.meteothes.gr/wxsim_wxall_fcast.php

Any help on this would be appreciated!

Thanks,

Thanos

Weather Live! at the Historical Center of Thessaloniki
Central Macedonia - Northern Greece

Offline i_fiorentino

  • Forecaster
  • *****
  • Posts: 556
  • Davis Vantage Vue, Boltek Stormtr., Mobotix M22-IT
    • Meteopistoia.it
Re: "3in1" Script won't run with PHP version 7.1 - RESOLVED
« Reply #22 on: March 13, 2018, 12:14:11 PM »
On my site it works fine with php 7.x.
Can i help you?

http://www.meteopistoia.it

 

anything