Pi Hole API on Buster Apache2 - Not authorized!

I'm running apache2 on buster and latest Pi-Hole.
Pi-Hole is running, and it looks like running well.
Except when I try to show the API token in Admin, I get a new blank page: Not authorized!

I tried from commandline:

sudo php api_token.php 
<html><body>
PHP Warning:  session_start(): Cannot start session when headers already sent in /var/www/html/admin/scripts/pi-hole/php/password.php on line 12
PHP Notice:  Undefined index: SERVER_NAME in /var/www/html/admin/scripts/pi-hole/php/auth.php on line 41
PHP Notice:  Undefined index: HTTP_HOST in /var/www/html/admin/scripts/pi-hole/php/auth.php on line 53
<p>Not authorized!</p></body>
</html>

Does this say anything, to solve this?
Permission in the folder are set to www-data. How can I solve this?

I managed to bypass this problem. I found this solution:

You need to have a password set for the Pi-hole installation, and the API key is the salted version of that password. You can find it as the value for the key WEBPASSWORD in your /etc/pihole/setupVars.conf

Now I can control pi-hole with Flutterhole.
Stil I do not understand why this was not working on the admin page.

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