wxobs skin on weewx 5.1

307 views
Skip to first unread message

lucien mornet

unread,
Jun 7, 2025, 3:31:27 PM6/7/25
to weewx-user
Hello, I installed the obs skin, but access to the database fails. Excerpt from the conf section of weewx.conf for the wxobs skin:
[StdReport]
    [[wxobs]]
        enable = true
        lang = en
        skin = wxobs
        HTML_ROOT = /var/www/html/weewx/wxobs
        unit_system = METRIC
        [[[Units]]]
            [[[[Groups]]]]
                group_direction = degree_compass
                group_percent = percent
                group_pressure = hPa
                group_rain = mm
                group_temperature = degree_C
                group_speed = km_per_hour

lhas output var/log/lighttpd/error.log

2025-06-07 16:42:22: (mod_fastcgi.c.449) FastCGI-stderr:PHP Fatal error:  Uncaught Exception: Unable to open database: unable to open database file in /var/www/html/weewx/wxobs/index.php:431
2025-06-07 16:42:22: (mod_fastcgi.c.449) FastCGI-stderr:Stack trace:
2025-06-07 16:42:22: (mod_fastcgi.c.449) FastCGI-stderr:#0 /var/www/html/weewx/wxobs/index.php(431): SQLite3->__construct()
2025-06-07 16:42:22: (mod_fastcgi.c.449) FastCGI-stderr:#1 {main}
2025-06-07 16:42:22: (mod_fastcgi.c.449) FastCGI-stderr:  thrown in /var/www/html/weewx/wxobs/index.php on line 431

php8.2 install

In the file: /var/www/html/weewx/wxobs The database path is correct. Extract from the file: index.php

} elseif ($php_dbase === 'sqlite') {
    if ($debug=='1') {
        echo "<p class=\"debug\">database is sqlite with path/name: /home/lucien/weewx-data/archive/weewx.sdb</p>";
    }
    $db = new SQLite3($php_sqlite_db);
} else {
    echo "<div class =\"alert\"><p>Failed to access the database by any known methods.</p></div>";
}

I don't know where to look anymore. Thank you for your help. Have a nice day.


vince

unread,
Jun 7, 2025, 7:28:01 PM6/7/25
to weewx-user
Contact the skin author, but my ‘guess’ is that the webserver process user might not have permission to access the db file in your home directory.

Glenn McKechnie

unread,
Jun 7, 2025, 8:29:51 PM6/7/25
to weewx...@googlegroups.com
First thought is a permissions issue, but the error message is usually more explicit when it's that. I don't have a running instance of lighttpd anymore so I'm not sure how it treats paths / files. Mine is running with apache and the weewx-venv set up.

The database that exists at /home/lucien/weewx-data/archive/weewx.sdb; I assume is readable by the main weewx process and has valid contents.

When I get a moment I'll do a simulation setup using lighttpd.

My direct email address can be found within the various files. wxobs/skin.conf has it at the top.

Send, to that address, your wxobs/skin.conf file
your /var/www/html/weewx/wxobs/index.php file
and your @include file. That file is referenced around line 62 of the index.php file. The following snippets shows '/usr/share/php/wxobs_weatherpi.inc' but I need the one from your path.

 *X                                                                                                                                                                                            
 *ini_set('display_errors', 1);                                                                                                                                                                
 *error_reporting(~0);                                                                                                                                                                          
 */                                                                                                                                                                                              
$start = microtime(true);                                                                                                                                                                      
                                                                                                                                                                                               
if ((@include '/usr/share/php/wxobs_weatherpi.inc') === false) {                                                                                                                              
    echo "<div class=\"alert\">";
 


Cheers
 Glenn

Various WeeWx addons at
https://github.com/glennmckechnie


--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/weewx-user/d93de9f2-37d8-42a6-993a-07ec2c004835n%40googlegroups.com.

lucien mornet

unread,
Jun 8, 2025, 3:30:54 AM6/8/25
to weewx-user

Thank you for your replies. I have the same error with Apache. I'll send you the files.

lucien mornet

unread,
Jun 8, 2025, 3:42:03 AM6/8/25
to weewx-user
I haven't provided you with my installation
rpi4, weewx-venv configuration

Glenn McKechnie

unread,
Jun 11, 2025, 7:58:02 PM6/11/25
to weewx...@googlegroups.com

I haven't received anything to my skin.conf gmail address. I assume you sent the files?

Interesting that it runs under Apache. A bit of a puzzle.

The location of the weewx database has to be visible to the web server. The servers have different ideas on what is restricted however the default location for a weewx-venv installation has proven okay with apache, assuming your installation allows the webserver to display those files in the first instance. If you can access the weewx html pages via your browser then I'd consider that a working installation and the database should be accessible via the php installation - providing that is set up. apt install php-sqlite3 should do that, and apt install php-cgi is what I have noted for a lighttpd installation. You may have to enable them in the server configuration as per note 6. in the README.

You can test your php installation and see if it has SQLite support by creating a test.php file with the following contents, save it in your webserver directory, then open it with your browser. Have a look for any SQLite
test.php...
<?php
    phpinfo();
?>



Cheers
 Glenn

Various WeeWx addons at
https://github.com/glennmckechnie

vince

unread,
Jun 11, 2025, 9:24:59 PM6/11/25
to weewx-user
On a pi using a venv, the usual error is that $HOME is mode 700 and the webserver cannot read through the top of $HOME down into the www-data files therein.  So for this thread I'd suggest Lucien check his permissions on $HOME and which groups user 'lucien' and whatever user the webserver runs as (www-data usually).

My guess is that if you run the following commands your output will look something like:

$ ls -al /home
total 20
drwxr-xr-x  5 root     root     4096 May 13 22:57 .
drwxr-xr-x 18 root     root     4096 Mar 15  2024 ..
drwx------ 10 lucien   lucien   4096 Dec 12 11:54 lucien

$ groups lucien
lucien: lucien users

$ groups www-data
www-data: www-data

(so by default, the webserver cannot read files under the other account's $HOME)

At a minimum, it might be worth a quick check to see more info on the configuration.  Lucien's problem descriptions are a bit minimal....

lucien mornet

unread,
Jun 16, 2025, 4:57:30 AM6/16/25
to weewx-user
Hello, If the permissions on /home weren't correct,
 the Belchertown and Seasons skins wouldn't work? 
What information would you need?

Glenn McKechnie

unread,
Jun 16, 2025, 7:53:54 PM6/16/25
to weewx...@googlegroups.com
On Mon, 16 Jun 2025 at 18:57, 'lucien mornet' via weewx-user <weewx...@googlegroups.com> wrote:
Hello, If the permissions on /home weren't correct,
 the Belchertown and Seasons skins wouldn't work? 

And by that you mean they are. OK. But Seasons/wxobs isn't...
 
What information would you need?

The results from the test.php file that I outlined previously, that file placed within your wxobs directory then accessed by your web browser. That will show whether you have a working php installation (critical) , and if the wxobs directory is indeed available (readable). It will also indicate if SQLite is installed - with some interpretation required.

You've supplied the error messages that weewx throws but have not mentioned whether you get the wxobs page displaying in the browser. I'd expect it to at least display the built in error page that complains about no database being available (a message that is contained within that index.php page). I'm guessing - and it is a guess as I have nothing else to work from yet - that it's failing before the page is generated.  
 

Le jeudi 12 juin 2025 à 03:24:59 UTC+2, vince a écrit :
On a pi using a venv, the usual error is that $HOME is mode 700 and the webserver cannot read through the top of $HOME down into the www-data files therein.  So for this thread I'd suggest Lucien check his permissions on $HOME and which groups user 'lucien' and whatever user the webserver runs as (www-data usually).

My guess is that if you run the following commands your output will look something like:

$ ls -al /home
total 20
drwxr-xr-x  5 root     root     4096 May 13 22:57 .
drwxr-xr-x 18 root     root     4096 Mar 15  2024 ..
drwx------ 10 lucien   lucien   4096 Dec 12 11:54 lucien

$ groups lucien
lucien: lucien users

$ groups www-data
www-data: www-data

(so by default, the webserver cannot read files under the other account's $HOME)

At a minimum, it might be worth a quick check to see more info on the configuration.  Lucien's problem descriptions are a bit minimal....


It would still be helpful to know exactly what your results are to Vinces observations. It is sound advice and helps clarify what your installation is.

What are your home permissions?
What is your output for groups lucien, and groups www-data?

Additionally, permissions of /home/lucien/weewx-data and in particular /home/lucien/weewx-data/archive/ and the files within. 
If the webserver cannot read /home/lucien/weewx-data/archive/weewx.sdb then it will never work.
And just to be redundant, and remove all doubt, your permissions for /home/lucien/weewx-data/public_html

If you don't want to post all that info to this group, then my email box is still vacant; and I'd still like to see those files I asked for previously. 
You can also send the output (saved html) of the test.php file as well.

FWIW. I can't duplicate this error here - yet. So more clues are needed.

You supplied the error log for lighttpd. What is the error message that apache2 throws to its error.log. Send that as well.

Glenn McKechnie

unread,
Jun 17, 2025, 3:25:23 AM6/17/25
to weewx...@googlegroups.com
I ran through the installation process as outlined in the README.

First, a fresh installation of weewx...
I used apache2 (you said it also failed using apache), the latest weewx pip installation, and an updated debian based raspberry pi 5.

Copied the supplied weewx-data/util/apache/weewx.conf over to the /etc/apache2/conf-available/  directory, changed the 2 paths within that file to reflect the changed home directory, enabled the conf and restarted apache2. After the permission problem noted by vince that gave me a working weewx (simulator) , it displayed the html data / images. That permission change was to the users home directory, and it was set to 0755 - the weewx-venv install of weewx set the correct permissions for the main weewx-data directories.
CAVEAT: That's done with the weewx default installation of public_html being located in the users home directory. We could have a long, possibly animated discussion about the merits of that but for these purposes I'm going with the default installation of HTML_ROOT. ( If user www-data is added to the users group then 0710  is sufficient. YMMV.)

With that done, I installed wxobs as per the README, noting points 6. and 4. as required (that's the modules and test.php script) and restarted the webserver.

That resulted in the usual failure (red text) on viewing the wxobs/index.php page from the browser. By then following the procedure outlined there, ie:-  creating /usr/share/php and cp -p  the wxobs_weewx.inc file to that location it was ready for a retest. (those points are also noted in the README). Reloaded the browser and - viola - the page displays the database contents for the current date, and the calendar works to change it..


Cheers
 Glenn

Various WeeWx addons at
https://github.com/glennmckechnie

lucien mornet

unread,
Jun 17, 2025, 8:51:12 AM6/17/25
to weewx-user
Bonjour, 
Glenn McKechnie
I sent you the files, index.php, skin.conf and wxobs_weewx.inc yesterday to your mailbox

permissions on
ls -la /home/lucien/weewx-datatotal 1892
drwxr-xr-x  9 lucien lucien      4096 Jun 17 14:30 .
drwx------  8 lucien lucien      4096 Jun 16 10:09 ..
drwxr-xr-x  2 lucien lucien      4096 Jun 17 14:30 archive
drwxr-xr-x  3 lucien lucien      4096 Jun  9 14:53 bin
drwxr-xr-x  8 lucien lucien      4096 Jun  9 14:47 examples
drwxrwxr-x  4 lucien www-data    4096 Jun  9 19:20 public_html
drwxr-xr-x  2 lucien lucien      4096 Jun  9 14:53 scripts
drwxr-xr-x 11 lucien lucien      4096 Jun 11 15:56 skins
drwxr-xr-x 18 lucien lucien      4096 Jun  9 14:47 util
-rw-r--r--  1 lucien lucien     26787 Jun 12 19:06 weewx.conf
-rw-r--r--  1 lucien lucien     21330 Jun  9 20:23 weewx.conf.20250609203407
-rw-r--r--  1 lucien lucien     21776 Jun  9 20:34 weewx.conf.20250610084850
-rw-r--r--  1 lucien lucien     26618 Jun 10 09:58 weewx.conf.20250610164315
-rw-r--r--  1 lucien lucien     26658 Jun 10 18:24 weewx.conf.20250611001400
-rw-r--r--  1 lucien lucien     26767 Jun 11 10:29 weewx.conf.20250611114835
-rw-r--r--  1 lucien lucien     26658 Jun 11 11:48 weewx.conf.20250611155653

ls -la  /home/lucien/weewx-data/archive/
drwxr-xr-x 2 lucien lucien       4096 Jun 17 14:33 .
drwxr-xr-x 9 lucien lucien       4096 Jun 17 14:30 ..
-rwxr-xr-x 1 lucien lucien 1472827392 Jun 17 14:33 weewx.sdb
-rwxr-xr-x 1 lucien lucien 1471594496 Jun 14 14:10 weewx.sdb_14062025
-rw-r--r-- 1 lucien lucien    1961984 Jun 10 09:01 weewx.sdb_old

groups lucien
lucien : lucien adm dialout cdrom sudo audio www-data video plugdev games users input render netdev spi i2c gpio


page navigateur de test.php
Capture d’écran du 2025-06-17 14-42-58.png

and wxobs browser pageCapture d’écran du 2025-06-17 14-44-03.pngI can select dates since 2012 but nothing is displayed

I have no data displayed, I can select dates since 2012 but nothing is displayed

Glenn McKechnie

unread,
Jun 17, 2025, 10:21:24 AM6/17/25
to weewx...@googlegroups.com

Nothing has arrived here, neither in 'All Mail' or 'Spam'.  Yet another of life's little mysteries?
glenn.mckechnie  (a t)  gmail.com

If you're sending a screen shot, rather than the actual webpage (the text is preferred) then make it the first section of the test.php file. I want to see if the sqlite3.ini file is listed in the display. Your symptoms suggest that it is not installed as that will give you the data-less display.

Section 6 of the wxobs/README has the instructions to install and enable it.

for apache2...
apt install php-sqlite3
phpenmod sqlite3


then restart the web server.
for lighttpd ...
apt install php-sqlite3
And... I'm actually missing notes on enabling sqlite3, Try what's written in the README. If that doesn't work the same phpenmod sqlite3 command may work?
If not, do a web search on how to enable it.

Cheers
 Glenn

Various WeeWx addons at
https://github.com/glennmckechnie

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.

lucien mornet

unread,
Jun 19, 2025, 10:38:51 AM6/19/25
to weewx-user
Hello, 
I did a clean install on RPI4. 
The installation of Weewx with the Debian repositories. Everything went well. The Wxobs skin works wonderfully. 
Thank you for your help.

Reply all
Reply to author
Forward
0 new messages