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 4017) - 17 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

Yet Another Dayfile Reader (PHP)

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

Moderator: daj

stewartwlewis
Posts: 38
Joined: Sat 29 Jan 2011 7:08 pm
Weather Station: Davis VP2 Plus
Operating System: Rasbian on RPI
Location: Durham, Co Durham
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by stewartwlewis »

Hi beteljuice
Thanks so much for the reply, small change and all working great including formatting. I was going to look at that when I got the tables working but it would have taken me ages - if ever.
I didn't think I had changed anything and was following the instructions. The line in the download is:-
$this_file_name = basename(__FILE__); // IMPORTANT - for best results this file should be in the SAME directory as the 'holding' page that uses it
So I just changed __FILE__ for the name of my file, should have known to put it in quotes.
That's the problem with doing stuff you don't understand, I have learned a huge amount though and thanks again for sorting it all for me.
Thanks
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Yet Another Dayfile Reader (PHP)

Post by beteljuice »

Ahh ...

Code: Select all

$this_file_name = basename(__FILE__);
You only need to modify that line if the (whateveritscalled) file is NOT in the same directory as its 'container'

__FILE__ is php shorthand for this whateveritscalled
Image
......................Imagine, what you will KNOW tomorrow !
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: Yet Another Dayfile Reader (PHP)

Post by sfws »

Just in case that last post was not entirely clear to someone who does not know PHP

__FILE__ (underline underline F I L E underline underline) represents in PHP the entire path of whatever file this syntax appears in
e.g. web_root/my_web_pages/betel_readDayfile.php

basename(__FILE__) represents only the last part of that filename e.g. betel_readDayfile.php


This does not change the basic message, put files in same directory and no path specifier is needed (although the dot notation ./betel_readDayfile.php can be used to stress it is in same directory)
Phil23
Posts: 884
Joined: Sat 16 Jul 2016 11:59 pm
Weather Station: Davis VP2+ & GW1000 (Standalone)
Operating System: Win10 Pro / rPi Buster
Location: Australia

Re: Yet Another Dayfile Reader (PHP)

Post by Phil23 »

Any idea's on why mine is broken?

Was fine a few days ago.

http://weather.inverellit.com/datasummary.php

http://weather.inverellit.com/checkserver.php


Background:-

Web Hosts have had major issues during the past 24 hours.
Emails up & down,
FTP the same,
Entire sites down.
cPanel not accessible.

Html & emails came back eventually, but PHP pages seemed to be the last to return, but just not including my dayfile reader.

Any thoughts?

Thanks

Phil.
:Now: :Today/Yesterday:

Image

Main Station Davis VP2+ Running Via Win10 Pro.
Secondary Stations, Ecowitt HP2551/GW1000 Via rPi 3 & 4 Running Buster GUI.
:Local Inverell Ecowitt Station: :Remote Ashford Ecowitt Station:
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: Yet Another Dayfile Reader (PHP)

Post by sfws »

Phil23 wrote: Wed 01 Jul 2020 10:56 am
http://weather.inverellit.com/checkserver.php

PHP pages seemed to be the last to return
You are now on php 7.2.28 according to that page. If your provider has been making changes, what exactly have they altered?

What were you on before? Sometimes, new releases of PHP can stop code written for older PHP versions from working. I don't use this code from beteljuice, but it has been around for a while and might not be written for 7.2.

I once used 5.x, then 7.0 and later 7.1, but I skipped 7.2 and have been using 7.3.x for a while myself, (because some of my scripts fail with 7.4, and with moving home consequences I can't spare time to relearn PHP and rewrite my PHP scripts just now).

You could add

Code: Select all

error_reporting(E_ALL);
to the start of the PHP code in your file to make it report all errors, that will tell you why the PHP parse failed, later when you find how to correct the error, comment that out!
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Yet Another Dayfile Reader (PHP)

Post by beteljuice »

At the top of the file just 'reverse' all the comments and we'll try to make sense of it.

from:

Code: Select all

 error_reporting(0); // Turn off error reporting
// ini_set('display_startup_errors',1);
// ini_set('display_errors',1);
// error_reporting(-1);
// error_reporting(E_ALL);
To:

Code: Select all

// error_reporting(0); // Turn off error reporting
 ini_set('display_startup_errors',1);
 ini_set('display_errors',1);
 error_reporting(-1);
 error_reporting(E_ALL);
Image
......................Imagine, what you will KNOW tomorrow !
Phil23
Posts: 884
Joined: Sat 16 Jul 2016 11:59 pm
Weather Station: Davis VP2+ & GW1000 (Standalone)
Operating System: Win10 Pro / rPi Buster
Location: Australia

Re: Yet Another Dayfile Reader (PHP)

Post by Phil23 »

Thanks.

I suspect they attempted some failed upgrade process & as a result I did notice that PHP selections had changed.

Turned the error checking on & got this returned.

Code: Select all

Fatal error: Uncaught Error: Call to undefined function cal_days_in_month() in 
/home/inv49478/public_html/weather/betel_readDayfile.php:685 Stack trace: #0 
/home/inv49478/public_html/weather/betel_readDayfile.php(2454): drawCalendar('2020') #1 
/home/inv49478/public_html/weather/datasummary.php(28): include_once('/home/inv49478/...') #2 {main} thrown in 
/home/inv49478/public_html/weather/betel_readDayfile.php on line 685
Thanks

Phil.
:Now: :Today/Yesterday:

Image

Main Station Davis VP2+ Running Via Win10 Pro.
Secondary Stations, Ecowitt HP2551/GW1000 Via rPi 3 & 4 Running Buster GUI.
:Local Inverell Ecowitt Station: :Remote Ashford Ecowitt Station:
Phil23
Posts: 884
Joined: Sat 16 Jul 2016 11:59 pm
Weather Station: Davis VP2+ & GW1000 (Standalone)
Operating System: Win10 Pro / rPi Buster
Location: Australia

Re: Yet Another Dayfile Reader (PHP)

Post by Phil23 »

Looks like it's a version compatibility thing.

Just tried reverting the domain to PHP 5.6 & it all behaves normally.

7.0 or later seems like where it breaks.

I'm happy to revert my site to 5.6, but if Beteljuice wants to test, I can leave it in the 7's.

Cheers.
:Now: :Today/Yesterday:

Image

Main Station Davis VP2+ Running Via Win10 Pro.
Secondary Stations, Ecowitt HP2551/GW1000 Via rPi 3 & 4 Running Buster GUI.
:Local Inverell Ecowitt Station: :Remote Ashford Ecowitt Station:
Mapantz
Posts: 1774
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by Mapantz »

It should work fine on 7.* as stated in the first post.

It looks to me like the calendar support has been disabled in PHP.

Just tested the beteljuice's version on PHP 7.3.19, all works fine: https://warehamwx.co.uk/betel/basic.php
Image
Phil23
Posts: 884
Joined: Sat 16 Jul 2016 11:59 pm
Weather Station: Davis VP2+ & GW1000 (Standalone)
Operating System: Win10 Pro / rPi Buster
Location: Australia

Re: Yet Another Dayfile Reader (PHP)

Post by Phil23 »

Mapantz wrote: Wed 01 Jul 2020 8:34 pm It should work fine on 7.* as stated in the first post.
It looks to me like the calendar support has been disabled in PHP.
Noticed I was on 7.1.1; just finished updating to 7.1.3. No Change.

I did notice a section with php extensions in cPanel, Can't see much that relates there.
:Now: :Today/Yesterday:

Image

Main Station Davis VP2+ Running Via Win10 Pro.
Secondary Stations, Ecowitt HP2551/GW1000 Via rPi 3 & 4 Running Buster GUI.
:Local Inverell Ecowitt Station: :Remote Ashford Ecowitt Station:
Mapantz
Posts: 1774
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by Mapantz »

Phil23 wrote: Wed 01 Jul 2020 8:59 pm

Noticed I was on 7.1.1; just finished updating to 7.1.3. No Change.

I did notice a section with php extensions in cPanel, Can't see much that relates there.
You might need to contact your hosting and check with them.
Image
Phil23
Posts: 884
Joined: Sat 16 Jul 2016 11:59 pm
Weather Station: Davis VP2+ & GW1000 (Standalone)
Operating System: Win10 Pro / rPi Buster
Location: Australia

Re: Yet Another Dayfile Reader (PHP)

Post by Phil23 »

Don't know much about PHP, but noticed now that while I've selected 5.6 in one area, 7.1 is selected in another....
MultiPHP Manager Vs Select PHP Version.

Checkserver.php show 7.1.33........
Capture.JPG
You do not have the required permissions to view the files attached to this post.
:Now: :Today/Yesterday:

Image

Main Station Davis VP2+ Running Via Win10 Pro.
Secondary Stations, Ecowitt HP2551/GW1000 Via rPi 3 & 4 Running Buster GUI.
:Local Inverell Ecowitt Station: :Remote Ashford Ecowitt Station:
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Yet Another Dayfile Reader (PHP)

Post by beteljuice »

It would seem they haven't completely 'compiled' the php package.

Contact your support
With:
Fatal error: Uncaught Error: Call to undefined function cal_days_in_month()

Web says ...

"recompile php with the "--enable-calendar" option."
Image
......................Imagine, what you will KNOW tomorrow !
Phil23
Posts: 884
Joined: Sat 16 Jul 2016 11:59 pm
Weather Station: Davis VP2+ & GW1000 (Standalone)
Operating System: Win10 Pro / rPi Buster
Location: Australia

Re: Yet Another Dayfile Reader (PHP)

Post by Phil23 »

I don't understand the Versions listed in the MultiPHP Manager.

There's:-

Code: Select all

PHP 4.4 (alt-php44)
PHP 5.1 (alt-php51)
PHP 5.2 (alt-php52)
PHP 5.3 (alt-php53)
PHP 5.4 (alt-php54)
PHP 5.5 (alt-php55)
PHP 5.6 (alt-php56)
PHP 7.0 (alt-php70)
PHP 7.1 (alt-php71)
Which all seem to report the version chosen,

Then further down the list there's

Code: Select all

PHP 5.1 (ea-php51)
PHP 5.2 (ea-php52)
PHP 5.3 (ea-php53)
PHP 5.4 (ea-php54)
PHP 5.5 (ea-php55)
PHP 5.6 (ea-php56)
PHP 7.0 (ea-php70)
PHP 7.1 (ea-php71)
PHP 7.2 (ea-php72)
PHP 7.3 (ea-php73)
When you choose from the first block you seem to get what you want.
Choosing from anything lower than 7.1 in the second block you get 7.1.

Calendar support seems to be in the ALT ones but not the EA's.
:Now: :Today/Yesterday:

Image

Main Station Davis VP2+ Running Via Win10 Pro.
Secondary Stations, Ecowitt HP2551/GW1000 Via rPi 3 & 4 Running Buster GUI.
:Local Inverell Ecowitt Station: :Remote Ashford Ecowitt Station:
Mapantz
Posts: 1774
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: Yet Another Dayfile Reader (PHP)

Post by Mapantz »

alt is something to do with cloudlinux. If ea is working correctly, that's the one to stick with.
Image
Post Reply