Page 5 of 7

Re: PHP script to display monthly/yearly snow depth totals from diary.db

Posted: Sun 01 Dec 2024 8:45 pm
by surban21
Dador - I'm almost ... almost ... certain the problem is coming from somewhere in your CMX Internet Settings. Could you attach a screenshot of Web/Upload Site and External Programs that are in the Internet Settings? I'm not an expert but I may be able to spot something. Further, are you using FTP to upload to your server or are you using the new PHP upload method which was implemented in CMX sometime in version 4.

Re: PHP script to display monthly/yearly snow depth totals from diary.db

Posted: Sun 01 Dec 2024 10:03 pm
by Dador
I use the traditional FTP method to send data to the server. As I mentioned, I didn't change the settings from the beginning when I ran the script, so it's strange that it suddenly stopped working.

Below is the configuration I use. Additionally, I am adding diary.db with new snow data from November and snowSummaryDataT.txt, the recording of which ended on October 2.

Currently, I use a package to handle php-8.3.14-Win32-vs16-x64.

Re: PHP script to display monthly/yearly snow depth totals from diary.db

Posted: Sun 01 Dec 2024 10:14 pm
by surban21
Are you using XAMPP with PHP installed through XAMPP? My Daily program is: C:\xampp\php\php-win.exe. I see yours as C:\PHP\php-win.exe.

Re: PHP script to display monthly/yearly snow depth totals from diary.db

Posted: Sun 01 Dec 2024 10:17 pm
by Dador
I removed xampp because I initially thought it was its fault.

Now I have the php package downloaded from this site -> https://windows.php.net/downloads/releases/

Re: PHP script to display monthly/yearly snow depth totals from diary.db

Posted: Sun 01 Dec 2024 11:56 pm
by surban21
Oh OK. Could you also attach screenshot of the settings under the "Web/Upload Site" heading in CMX Internet Settings. Maybe there's a clue in that? :idea:

Re: PHP script to display monthly/yearly snow depth totals from diary.db

Posted: Mon 02 Dec 2024 7:03 am
by Dador
My settings:

Re: PHP script to display monthly/yearly snow depth totals from diary.db

Posted: Mon 02 Dec 2024 10:03 am
by Dador
I try in different ways. Now by cmd. It causes an error.

Code: Select all

c:\PHP>php.exe -f c:\CumulusMX_VP2\webMX\snowSumData.php

Fatal error: Uncaught PDOException: could not find driver in C:\CumulusMX_VP2\webMX\snowSumData.php:52
Stack trace:
#0 C:\CumulusMX_VP2\webMX\snowSumData.php(52): PDO->__construct('sqlite:\\Cumulus...')
#1 {main}
  thrown in C:\CumulusMX_VP2\webMX\snowSumData.php on line 52
Line 52 in my snowSumData.php

Code: Select all

    $pdo = new PDO($myDbase);

Re: PHP script to display monthly/yearly snow depth totals from diary.db

Posted: Mon 02 Dec 2024 10:05 am
by freddie
To me it looks like you need to install a sqlite PHP module. The module will contain the driver for the database connections.

Re: PHP script to display monthly/yearly snow depth totals from diary.db

Posted: Mon 02 Dec 2024 10:08 am
by Dador
Ok,
I'll go back to xampp and play around. :)

Re: PHP script to display monthly/yearly snow depth totals from diary.db

Posted: Mon 02 Dec 2024 10:36 am
by Dador
It worked :!:

Reinstalling xampp and executing the script through Windows task scheduler helped.
Now the question is whether CMX will also be able to do this, or whether I will stick to the task schedule.

Re: PHP script to display monthly/yearly snow depth totals from diary.db

Posted: Mon 02 Dec 2024 1:44 pm
by surban21
Glad you were able to get it to run! I second what freddie said. If it's working using task scheduler, it "SHOULD" work again using CMX. At least it appears you're on the right track. Thanks @freddie for jumping in and giving your insight. :clap:

Re: PHP script to display monthly/yearly snow depth totals from diary.db

Posted: Mon 02 Dec 2024 6:42 pm
by Dador
My final conclusion is that since version 4.2 CMX has stopped executing external program parameters.
The snowSumData.php script works fine when I execute it via Windows Task Scheduler, but it doesn't work when I want to execute it via CMX.
I tried many ways to find a parameter that would work, but nothing worked.

Re: PHP script to display monthly/yearly snow depth totals from diary.db

Posted: Mon 02 Dec 2024 7:53 pm
by SamiS
If running external programs had been broken since the release of 4.2 over a month ago, someone else should have noticed it too. So there must be something else specific to your system affecting this.

One thing that comes to my mind, that are you running (the problematic instance of) CMX with the same user account that you are using to run the scheduled task (that works)?

Re: PHP script to display monthly/yearly snow depth totals from diary.db

Posted: Mon 02 Dec 2024 8:26 pm
by Dador
Well, I'm not saying it's a global CMX failure when it comes to executing external programs with parameters, but there's something to it.

@SamiS, quite recently I was contacted by email from a fellow Your countryman who uses the latest CMX release and also has a problem with the snowSumData script. I hope that when he comes across this thread, he will be able to run it, as I managed to do.

Currently, all cyclical external programs have been taken over by the Windows task scheduler. CMX is unemployed :D

Re: PHP script to display monthly/yearly snow depth totals from diary.db

Posted: Mon 02 Dec 2024 10:21 pm
by surban21
Dador wrote: Mon 02 Dec 2024 6:42 pm My final conclusion is that since version 4.2 CMX has stopped executing external program parameters.
Well something appears to have happened. I just upgraded to CMX 4.2,1 b4043 from 4.1.2 b4027 and the program parameters section of External Programs in CMX doesn't seem to process when trying to process php. I did not alter any settings during upgrade and started to get errors. The first error was: 2024-12-02 15:35:00 - Warning: Interval: External program 'C:\xampp\php\php-win' does not exist.

So I the added .exe to the end of this and fixed that error but now I get: 2024-12-02 16:05:08 - InitTCP: Error - Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host..

I'm not entirely sure but it appears either php is not executing from within CMX External Programs section and if it is it's not processing the program parameters. Now I run into the same scenario that Dador is having and snowSumData,php is not being processed since upgrading to 4.2.1 from 4.1.2.

I've done many upgrades in the past and haven't ran into any problems running the snow scripts until now. Any insight into this would be helpful.

EDIT: Reverted back to 4.1.2 b4027 and is processing normally.