OwnCloud works fine, but occ complains no database configured

When I try to use occ to fix the files section of my OwnCloud instance, it complains that there is no database configured:

sudo -u www-data occ file:scan --help
No database drivers (sqlite, mysql, or postgresql) installed.

PHP modules have been installed, but they are still listed as missing?
Please ask your server administrator to restart the web server.

This is obviously not the case as the web site is working fine. What do I need to do to get occ working?

I'm using a Raspberry Pi running Jessie Pixel and installed everything using packages. Everything is up to date

you are using a different php executable or php configuration in the terminal compared to the web server.