PWS_cron_stationcron fails when run from the host cron scheduler

After giving up on the free hosting site, I had problems getting the PWS_cron_stationcron to work when run from the cron scheduler of the new host site.
(The status check kept turning red)
It ran fine when I used the browser.
Here are the errors:

Warning: file(languages/lang_en.txt): failed to open stream: No such file or directory in /home2/beac01185xxx/public_html/pwsWD/PWS_settings.php on line 304

Warning: Invalid argument supplied for foreach() in /home2/beac01185xxx/public_html/pwsWD/PWS_settings.php on line 305

Warning: file_put_contents(./_my_settings/status.arr.tmp): failed to open stream: No such file or directory in /home2/beac01185xxx/public_html/pwsWD/PWS_load_files.php on line 56

My amateur fix was to change the following:
line 304 changed
else { $arr = file ('languages/lang_en.txt');
else { $arr = file (__DIR__.'/languages/lang_en.txt');

lines 41,42 changed

$status_arr = './_my_settings/status.arr';
$status_arr_nw = './_my_settings/status.arr.tmp';
$status_arr = __DIR__.'/_my_settings/status.arr';
$status_arr_nw = __DIR__.'/_my_settings/status.arr.tmp';

Are we still having fun?

1 Like

We’re always having fun :crazy_face:

Hi Bruce,
Sorry that you run into these two addressing errors.

Normally the provider cron-server should point to the executing folder correctly.
Which is the folder the PWS_cron_stationcron.php script is executed in. In your case pwsWD.

The websites I test with (3 different providers) did not had this problem you encountered when I tested in the past.

Would you be so kind to add to the cron setup?
→ . . . . /_test.php?test=PWS_cron_stationcron.php
I hope to get more errors.



As PWS_Dashboard only uses 1 cron, try to use an external cron-provider such as

That way the cron is executed at the same way as in a browser.
Also we can get a log if there are errors.

If you use the providers cron facilities: check the error logs a.s.o. to catch other addressing problems.

I had to use to get the _test.php?test=PWS_cron_stationcron.php to run.
Evidently the provider cron-server doesn’t let you use the “?” in the URL.
I found this out when I tried to redirect the output of "PWS_cron_stationcron.php?test " during my hunt for the red status check problem.

Hi Bruce,

The only errors I got today occurred when moving a complete “pwsWD” folder to another webserver.
One has to run PWS_easyweathersetup.php to get the file locations correct.

Also one has to delete the . . ./pwsWD/_my_settings/status.arr.
That file has the full folder list from the previous server. Example

/Users/willemvanderk. . . 230/pwsWDxx/jsondata/weatherflow.txt

I did not get your errors, but those are genuine so I will update the scripts accordingly.

Can you please use in the cron setting this small script?
It loads the PWS_cron_stationcron.php after setting the error messaging correctly.
Just once / day and select in cPanel an email with the messages.
I hope to catch other warnings/errors that way.

Wim (1.1 KB)