In the hope that this will save someone else hours of fruitless searching…
sudo -u user-account php occ didn’t work for me - threw an error in console.php complaining that it wasn’t command line
However, if I switched to the user-account first (su user-account), then php occ worked