Hi, I am trying to set up the EWN style display script for WXSim. My server is running PHP 7.x but when I run the _test.php page I get the following:
Warning: Use of undefined constant lang - assumed 'lang' (this will throw an Error in a future version of PHP) in /var/www/html/weather/wxsim-ewn/wxsim/config.php on line 62
Notice: Undefined index: lang in /var/www/html/weather/wxsim-ewn/wxsim/config.php on line 62
Notice: Undefined variable: lang in /var/www/html/weather/wxsim-ewn/wxsim/config.php on line 63
Notice: Undefined variable: lang in /var/www/html/weather/wxsim-ewn/wxsim/config.php on line 64
Warning: Use of undefined constant ewnwunit - assumed 'ewnwunit' (this will throw an Error in a future version of PHP) in /var/www/html/weather/wxsim-ewn/wxsim/config.php on line 285
Notice: Undefined index: ewnwunit in /var/www/html/weather/wxsim-ewn/wxsim/config.php on line 285
Notice: Undefined variable: uploadupdate in /var/www/html/weather/wxsim-ewn/wxsim/frc.php on line 24
Warning: Use of undefined constant lang - assumed 'lang' (this will throw an Error in a future version of PHP) in /var/www/html/weather/wxsim-ewn/wxsim/frc.php on line 43
Fatal error: Uncaught Error: Call to undefined function mb_detect_encoding() in /var/www/html/weather/wxsim-ewn/wxsim/frc.php:251 Stack trace: #0 /var/www/html/weather/wxsim-ewn/wxsim/frc.php(47): html2utf8() #1 /var/www/html/weather/wxsim-ewn/wxsim/config.php(290): include('/var/www/html/w...') #2 /var/www/html/weather/wxsim-ewn/forecast.php(6): include('/var/www/html/w...') #3 /var/www/html/weather/wxsim-ewn/_test.php(5): include('/var/www/html/w...') #4 {main} thrown in /var/www/html/weather/wxsim-ewn/wxsim/frc.php on line 251
Any ideas? I basically uploaded the contents of the zip then set up config.php with the correct paths. TIA
Lastret.txt and plaintext.txt are both copied every report cycle to /var/www/html/weather , and as you can see the Saratoga script is reading plaintext.txt without issue.
I downloaded the WXSim 3in1 script from the nordic weather website, and uploaded the wxsim-ewn folder to my server under the weather directory. The contents of my config.php are:
$wxsimlocation = "Lerwick, Shetland Islands"; # Your location
$latitude = 60.45;
$longitude = -1.1;
$tzabb = "Europe/London";
$datestyle = "d.m.Y";
$timeFormat = "d.m.Y H:i"; # Timeformat
$updatehrs = array(3,6,9,12,15,18,21); # Hours when wxsim runs
$updateminute = 14; # minutes past full hour for upload time
$jqueryload = true; # Should we load JQuery? (Set to false if your site loads it by default)
$bootstrapload = true; # Should we load Bootstrap? (Set to false if your site loads it by default)
$mainwidth = "100%"; // Use 100% for responsivity
$path_to_langfiles = "./lang/";
$path_to_lastret = "/var/www/html/weather/lastret.txt";
$path_to_dataphp = "./wxsim";
$path_to_js = "./js/";
$path_to_css = "./css/";
I’ve played around with the paths but still it’s not reading any data. I am running PHP Version 7.4.3-4ubuntu2.26.
There appears to be several versions of the scripts so I’m not 100% sure which I should use. I have downloaded some from this forum, although when I tried I still got errors and no data. Documentation is sketchy to say the least! Appreciate your help.
It works fine as long as it’s only lastret.txt in the path. As soon as I copy plaintext.txt into the directory it just starts spinning again. Is it maybe because the plaintext.txt file spans longer that the lastret.txt?
This is my settings (I have changed it to 7 days from 3 days). I don’t have the agricultural data (as you can see they are greyed out). I do have the full professional mode with enhanced customisation.
Sorry, I maybe didn’t explain it well. Lastret.txt and plaintext.txt are uploaded to my web server via WeeWX / rsync. The path to both of these is /var/www/html/weather. When I was testing the paths I copied lastret.txt into the wxsim-ewn directory and the script displayed what I showed above. As soon as I copied plaintext.txt into wxsim-ewn the script just show the waiting circle. As soon as I delete plaintext.txt then it displays the content from lastret.txt. Does that make sense?
If you do not add that to PHP , simply set line 375 in wxsim/plaintext.php to comment. From if(!mb_detect_encoding($fixedtxt, 'UTF-8', true)){$fixedtxt=utf8_encode($fixedtxt);}
Thanks again Wim, that’s it working now. I enabled the mb_detect_encoding and it sprung in to life. Apologies, I forgot about that after I uploaded the new scripts you sent.
Wim screen shot is of a 2013 version and the agricultural setting may depend on the version he got at the time
Mine is greyed out as I would expect as the info I sent Tom at purchase time did not include its use, so if you need the agricultural data you should email Tom