Pihole undefined offset admin panel not accepting settings

Install:

I have a pi 4 with NGINX as server. It is also running Nextcloud(also on php7.4) and I have pihole on php7.4. Both are talking to php-fpm through sockets. I created sockets for both of these seperately.
Apart from this it is a standard pihole install.

Also I added the auth_basic because I saw this in a tutorial and thought maybe it will solve my problem. If this is not needed I would like to delete these. Now the browser ask me for a password and then right after, pi hole also wants me to sign in. I think only the pihole sign in is safe enough for home use.

Expected Behaviour:

I expect that the admin page will be able to accept settings and that I can do stuff in the admin panel.
I use:

  • raspberry pi 4
  • ubuntu server 20.04 LTS
  • pihole is installed in /home/pihole instead of /var/www (but this should not cause the issue right?)
  • everything connected with cable
  • I run pihole as user pihole, and run my server as user server
  • ufw firewall:

To Action From


22/tcp ALLOW IN Anywhere
80,443/tcp (Nginx Full) ALLOW IN Anywhere
22/tcp (v6) ALLOW IN Anywhere (v6)
80,443/tcp (Nginx Full (v6)) ALLOW IN Anywhere (v6)

Actual Behaviour:

The admin panel says it succesfully set the setting. But on reload nothing has changed. Also I get a php error about an offset not being set:

2021/02/16 19:33:06 [error] 5771#5771: *1 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined offset: 2 in /home/pihole/admin/scripts/pi-hole/php/update_checker.php on line 46PHP message: PHP Notice: Undefined offset: 2 in /home/pihole/admin/scripts/pi-hole/php/update_checker.php on line 47PHP message: PHP Notice: Undefined offset: 2 in /home/pihole/admin/scripts/pi-hole/php/update_checker.php on line 52PHP message: PHP Notice: Undefined offset: 2 in /home/pihole/admin/scripts/pi-hole/php/update_checker.php on line 58" while reading upstream, client: 192.168.2.200, server: _, request: "GET /admin/groups-domains.php?type=white HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.4-fpm-pihole.sock:", host: "192.168.2.1", referrer: "http://192.168.2.1/admin/"

I don't know what that error is or how I can solve it, but I think that error is the problem. I believe this may be the problem.

Debug Token:

kv1xx84hdr

PS: nginx site file:

server {
listen 80 default_server;
listen [::]:80 default_server;

root /home/pihole;
server_name _;
autoindex off;

index pihole/index.php index.php index.html index.htm;

location / {
    expires max;
    try_files $uri $uri/ =404;
}

location ~ \.php$ {
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
    fastcgi_pass unix:/run/php/php7.4-fpm-pihole.sock;
    fastcgi_param FQDN true;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
}

location /*.js {
    index pihole/index.js;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
}

location /admin {
    root /home/pihole;
    index index.php index.html index.htm;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
}

location ~ /\.ht {
    deny all;
}
}

Check the doc to see if it helps.

https://docs.pi-hole.net/guides/webserver/nginx/

Yeah so I figured a few things out by searching for the php files. Apparently pihole can't get the ftl version, branch and githubversion from /etc/pihole/{localversions, localbranches,GitHubVersion} So I manually added a random number to the end of these files and that problem is gone.(like patched, but still a problem why it can't get these ftl-versions?)

the next problem is now, when changing a dns I get the error:

2021/02/17 21:21:46 [error] 23857#23857: *1 FastCGI sent in stderr: "PHP message: PHP Warning: Executing sudo pihole -a -i single -web failed. in /home/pihole/admin/scripts/pi-hole/php/func.php on line 79PHP message: PHP Warning: Executing sudo pihole -a setdns "208.67.222.222" domain-needed bogus-priv no-dnssec failed. in /home/pihole/admin/scripts/pi-hole/php/func.php on line 79" while reading upstream, client: 192.168.2.200, server: _, request: "POST /admin/settings.php?tab=dns HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.4-fpm-pihole.sock:", host: "192.168.2.1", referrer: "http://192.168.2.1/admin/settings.php?tab=dns"

It errors on sudo pihole -a setdns "208.67.222.222" but when I run that command from terminal(as the same user as pihole runs as(pihole) and as the same user the server runs as(server)) it just works. Do you have any id how that can be?

No, unfortunately not. I don't use NGINX. Maybe other users can help you. You debug log looked Ok. Have you searched the forum for similar errors?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.