Pi-hole missing SQLite3

Pi-Hole is an ad blocker you run on a Raspberry Pi on your local network to provide ad blocking services to all the devices in your home.

A new install of Pi-Hole

When installed normally it uses Lighttpd but I already had Apache2 on my Raspberry Pi. There are a few threads and this doc about migrating to Apache2 but none of them mention SQLite3.

If you don’t have that module installed the ad blocking part will still work but the web admin will show an almost empty page. Look in /var/log/apache2/error.log and you’ll see an error like this:

PHP Fatal error: Uncaught Error: Class 'SQLite3' not found in /var/www/html/admin/scripts/pi-hole/php/database.php

It’s easy to install the SQLite3 mod for PHP:

sudo apt install php-sqlite3

Then restart Apache2

sudo service apache2 restart 

I’ve had Pi-Hole installed for years but I think I ran into the read-only problem mentioned here too. As stated in the doc above, the fix is simple. Add the Apache user to the pihole group. That will allow you to update various settings from the web admin.

sudo usermod -a -G pihole www-data