blog til projects meta feed
~ / til / Fixing php errors in a Nextcloud docker-compose configuration 2023-03-01 | 2 minutes
I was trying to rescan the files in my Nextcloud server (running on Raspberry Pi 4 with DietPi), and kept running into some weird php errors.
First error - “could not find driver”
I was trying using the following syntax to call occ and scan the files:
sudo -u www-data php /path/to/nextcloud/occ files:scan --all
but I kept running into a PHP error. Specifically this error:
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: could not find driver in /path/to/nextcloud/lib/private/DB/Connection.php:139
followed by a long, verbose stack trace.
It took me a decent amount of time to diagnose the exact issue, but eventually I found this list of required PHP modules in the Nextcloud admin manual.
Running php -m will print out the list of currently installed PHP modules. I noticed I was missing quite a few of the required modules, but the one that was causing my issue was the missing pdo_mysql module.
This can be installed by running:
sudo apt-get install php7.4-mysql
Note: This command will change based on your OS, PHP version and database type
This resolved the error! However (as is always the case), this only meant I got a shiny new error instead:
Second error - “Name or service not known”
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known in /path/to/nextcloud/lib/private/DB/Connection.php:139
From first glance, this looks like something wrong in the DNS name resolution. This sent me a long way down the wrong path, changing a whole bunch of things in my docker-compose.yml file.
Eventually however, after a long and perilous journey over the high seas of Nextcloud forums and StackOverflow, I found this example of running php occ in a docker-compose configuration.
This led me to running this command:
docker-compose exec -u www-data nextcloud-app php occ files:scan --all
Note: replace nextcloud-app with the name of your Nextcloud container. Also, this command must be run from the directory of your Nextcloud docker-compose.yml
….aaaaaand, voila! The command runs, the files are scanned and everything is up to date.

Articles from blogs I follow around the net
First impressions of jj from a git fan
What is jj? Jujutsu (jj) is a distributed version control system (like git, hg, darcs, pijul, etc.). However, it is rather unique in that it is git-compatible—it uses git as a storage layer, meaning you can use it right now on your existin…
via Luke Hsiao's blog November 1, 2025Computer Says No: Error Reporting for LTL
Quickstrom is a property-based testing tool for web applications, using QuickLTL for specifying the intended behavior. QuickLTL is a linear temporal logic (LTL) over finite traces, especially suited for testing. As with many other logic systems, when a formu…
via Oskar Wickström November 1, 2025Cosytober 2025
Cosytober 2025 CosyTober is a “cosy alternative to #Inktober”. The idea is the same, all during October, each day a prompt is given and artists are asked to draw, paint or otherwise create something inspired by the prompt and post it to social media. I'…
via splitbrain.org - blog October 31, 2025Generated by openring
Last updated: 2025-11-03 15:58:51 +0000
v25.12.U1103
© Andrew Conlin 2023-2025
All rights reverse engineered