Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

PHP Deprecated error RESOLVED

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

Post Reply
User avatar
PaulMy
Posts: 3775
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

PHP Deprecated error RESOLVED

Post by PaulMy »

I have come to realize that I have a lot of errors in my website folders and beginning to work on fixing those. Some of these are likely caused by my adapting some posted scripts here and modifying incorrectly. Some of the errors appear to be due to deprecated code. One particular is from my once a minute cron job to import realtime.txt in my MySQL DB and this continued to add to the error_log.txt file which is getting quite large.
[12-Apr-2018 15:49:25 UTC] PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/psoykkrhjuz3/public_html/weather/ImportCumulusFile.php on line 234
Line 234 is

Code: Select all

  // Connect to the datbase
    $con = mysql_connect($dbhost, $dbuser, $dbpassword);
I have attempted to change this line to mysqli_connect() but that crashes the script. ImportCumulusFile.php has several lines of such mysql_ but only the first one shows in the error_log.

What changews should I make to eliminate these errorsÉ

Thanks,
Paul
Last edited by PaulMy on Fri 13 Apr 2018 2:56 pm, edited 1 time in total.
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm

Image
User avatar
mcrossley
Posts: 12692
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: PHP Deprecated error

Post by mcrossley »

Paul, you just need a newer version of the file, I changed it to mysqli some time ago.
User avatar
PaulMy
Posts: 3775
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: PHP Deprecated error

Post by PaulMy »

Thanks Mark, forgot to check the basics...
However, I have edited the v.3.1 with my DB info and the cron job fails and DB not updated. Cron job details are:

Code: Select all

Fetched URL
http://www.komokaweather.com/weather/ImportCumulusFile.php?type=realtime&key=xxxxx&table=realtime&file=realtime.txt
Status
500 Internal Server Error
I have used the same DB info and key as the previous version. Will look deeper but if any suggestion that is welcome.

Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm

Image
User avatar
mcrossley
Posts: 12692
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: PHP Deprecated error

Post by mcrossley »

Oh dear, can you get the error log from the server and see what the actual error was - HTTP error 500 is a generic "something went wrong" that doesn't tell you anything.
User avatar
PaulMy
Posts: 3775
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: PHP Deprecated error

Post by PaulMy »

Thanks Mark,
When I run the new version 3.1 from URL http://www.komokaweather.com/weather/Im ... altime.txt(not through cron-job) I get
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@komokaweather.com to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
and nothing shows on webserver error_log.txt

I have compared the version 2.3 I have been using (and changed back to now so my cron jobs can run) to the new v3.1 and all the DB settings seem identical (I don't use the dbconfig.php with this script)
The other differences between v3.1 and v2.3 are too complex for me to understand and are mainly below the --------- Nothing to edit below here -------------- area.

Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm

Image
User avatar
mcrossley
Posts: 12692
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: PHP Deprecated error

Post by mcrossley »

Version 2.7 made the change to mysqli, so maybe give that file whirl as it is closest to the version you have now?
User avatar
mcrossley
Posts: 12692
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: PHP Deprecated error

Post by mcrossley »

Actually, I just read the readme properly myself, there are two database changes you would have to make going from 2.3 -> 3.1 Though neither affect the realtime table :(

There is just one going from 2.3 -> 2.7

Code: Select all

ALTER TABLE `dayfile` CHANGE `HighSolarRad` `HighSolarRad` DECIMAL(5,1) NULL DEFAULT NULL
As always make a copy of the table before altering it so you can quickly switch back again.
User avatar
PaulMy
Posts: 3775
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: PHP Deprecated error -SOLVED

Post by PaulMy »

Thanks Mark,
Finally resolved using v2.7 and no errors being logged. However I had to change one line:
My previous v2.3 had line 181 as: die('Error: Failed security key check:' . $param_key . ' ' . $key);
The v2.7 download had line 199 : die('Error: Failed security key check:' . $param_key);
I changed line 199 in v2.7 to : die('Error: Failed security key check:' . $param_key . ' ' . $key);

Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm

Image
sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: PHP Deprecated error

Post by sfws »

PaulMy wrote: The v2.7 download had line 199 : die('Error: Failed security key check:' . $param_key);
I changed line 199 in v2.7 to : die('Error: Failed security key check:' . $param_key . ' ' . $key);
While I don't use Mark's script, and so I am not absolutely sure what the two variables are you that you mention, I can hazard a good guess from the message I have coloured up.

I am pretty sure Mark removed the second variable deliberately, what is the point of having a hidden key controlling write access if a failure to use it tells the hacker the key they should have used!

Post Script Edit: actually I have just looked at Mark's versions list
// ver 2.6 - 02/04/14, Mark Crossley * Fixed PHP vulnerability that could reveal the passcode
and see I am right.

I know you don't understand much PHP, Paul, but even you might guess that what is included in die messages has no effect on subsequent processing as the die instruction exits the code parsing.
User avatar
mcrossley
Posts: 12692
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: PHP Deprecated error

Post by mcrossley »

Odd Paul, as sfws said, that line will not affect the rest of the script, and you should really use the version from 2.7 for security.

Anyway, glad you got v2.7 going in the end, it should fix your original "Deprecated" error.
User avatar
PaulMy
Posts: 3775
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: PHP Deprecated error RESOLVED

Post by PaulMy »

Maybe a red herring yesterday, but when I first ran v2.7 it popped up some message for that line. I then compared to the previous working version and found the difference and changed the line and then it worked - nothing else done at the time. And yes :oops: I did not catch and understand the significance of that code difference.

So this morning went back to the original v2.7 without my edit, and it still works. I presume now as intended.

One deprecated issue resolved!

Thanks all for your assistance,
Paul
Davis Vantage Pro2+
C1 www.komokaweather.com/komokaweather-ca
MX www.komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX www.komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX www. komokaweather.com/cumulusmx4/index.htm

Image
Post Reply