Closed cvmiller closed 2 years ago
Craig, Thanks for posting the error. It looks like Alpine Linux may not have the Session module installed in their default packages. I believe you may have to install the php5-mod-session package. Matt
Thanks, installing php7-session
, and restarting `php-fpm7' has got past this error. Now I see a registration screen on my web browser.
However, a new error:
[error] 748#748: *32 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Class 'PDO' not found in /var/www/localhost/htdocs/lxd-dashboard/backend/config/login.php:133
Stack trace:
#0 {main}
thrown in /var/www/localhost/htdocs/lxd-dashboard/backend/config/login.php on line 133" while reading response header from upstream, client: 2607:c000:8011:fd00::32, server: _, request: "POST /backend/config/login.php?database_type=sqlite&database_host=&database_name=&database_user=&action=writeDatabaseConfig HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "[2607:c000:8011:fd00:216:3eff:fe84:8e3e]", referrer: "http://[2607:c000:8011:fd00:216:3eff:fe84:8e3e]/"
I am guessing PDO needs to be installed on Alpine, but what is the package name?
Found the Alpine package php7-pdo
.
However, now when I try to register a user, I get a dialog that pops up (on the web browser) that says "could not find driver" with a checkbox option to not show the error any longer. I don't see anything in the nginx or php error logs.
Any ideas?
Found the Alpine package php7-pdo_sqlite
A new errror (in the web dialog)
SQLSTATE[HY000] [14] unable to open database file
And it is true, I don't see a database file in /var/lxdware/data/sqlite
Did I miss a step in the installation? How does the sqlite file get created?
If you have the php7-pdo-sqlite module installed I would guess that the webserver may not have permissions then to create the database file in /var/lxdware/data/sqlite. I am not sure what user Alpine Linux sets as the user for the webserver. It probably is listed in the /etc/nginx/nginx.conf file on your server. In Debian based systems the default webserver user is www-data. For Alpine, you may have to create a user and configure that user in the nginx.conf file. Then grant write permissions to that user for anything in the /var/lxdware directory.
Thanks, for helping me with this. Yes, I do have the php7-pdo_sqlite
installed, the default user for nginx under Alpine is nginx
. I had already changed the permissions and ownership.
cd /var/lxdware/
/var/lxdware # ls -l
total 0
drwxrwxr-x 1 nginx www-data 0 Jan 2 23:27 backups
drwxrwxr-x 1 nginx www-data 18 Jan 2 23:27 data
/var/lxdware # ls -lR
.:
total 0
drwxrwxr-x 1 nginx www-data 0 Jan 2 23:27 backups
drwxrwxr-x 1 nginx www-data 18 Jan 2 23:27 data
./backups:
total 0
./data:
total 0
drwxrwxr-x 1 nginx www-data 0 Jan 2 23:27 lxd
drwxrwxr-x 1 nginx www-data 0 Jan 2 23:27 sqlite
./data/lxd:
total 0
./data/sqlite:
total 0
What is the sqlite database file called? Perhaps I can touch
it, and make sure the file is writable to user nginx
The sqlite database file would be located at /var/lxdware/data/sqlite/lxdware.sqlite and there is a configuration file that should also be created when you first login at /var/lxdware/data/db_config.php. The config file contains the following information within php tags: define( 'DB_TYPE', 'sqlite' ); define( 'DB_NAME', '' ); define( 'DB_USER', '' ); define( 'DB_PASSWORD', '' ); define( 'DB_HOST', '' ); This is created when logging in from https://github.com/lxdware/lxd-dashboard/blob/master/lxd-dashboard/backend/config/login.php lines 130-152.
Thanks that is a help. I got it to work by chmod -R o+w
to the /var/lxdware
directories. So clearly, the user is not nginx or in the group of www-data (since they had write privileges). It could be running as nobody:
PID USER TIME COMMAND
...
1500 root 0:03 {php-fpm7} php-fpm: master process (/etc/php7/php-fpm.conf)
1507 nobody 0:00 {php-fpm7} php-fpm: pool www
1508 nobody 0:00 {php-fpm7} php-fpm: pool www
1556 root 0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
1557 nginx 0:00 nginx: worker process
1558 nginx 0:00 nginx: worker process
1559 nginx 0:00 nginx: worker process
Later...
After a bit of work to delete session files and other cruft created by user nobody, and adding the following packages php7-json
php7-openssl
to Alpine Linux, I can log in.
So far here are the packages that I have had to load (and restart php-fpm7
daemon) to get things going.
apk add nginx php-fpm php-curl sqlite php-sqlite3 php7-session php7-pdo php7-pdo_sqlite php7-json php7-openssl
I also had to change the included nginx file to support the default location and how to talk to PHP (uses a loopback socket) in Alpine Linux:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/localhost/htdocs/lxd-dashboard;
index index.php index.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
#include snippets/fastcgi-php.conf;
#fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
#include snippets/fastcgi-php.conf;
include fastcgi.conf;
}
}
And of course change the user in /etc/php7/php-fpm.d/www.conf
;user = nobody
user = nginx
;group = nobody
group = www-data
Now I can start using the Dashboard, and start enjoying your software! Thanks for all the help.
Thanks for sticking with getting the LXD Dashboard on Alpine Linux setup. Your information is very helpful and I will use it to help create a installation guide on the website.
Installed release 3.1.0 in an Alpine 3.15 container.
I have things running for accessing the first page (I assume a login), however HTML screen is just a welcome page (with dimmed outline).
I note the following in the nginx /var/log/nginx/error.log
Went looking for the function definition in lxd-dashboard/, I see many calls to the function, but no function definition. Perhaps this function is defined elsewhere?