Nexctloud - occ command not working

Server info, from diagnostics:

I added files to Nextcloud via the filesystem, so the files are not known to Nextcloud.

I intended to use occ files:scan to tell Nexctloud about the files in this way:

# sudo -u nextcloud php7.4 /var/www/nextcloud/occ files:scan --path="wbk/files/"
An unhandled exception has been thrown:
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: could not find driver in /var/www/nextcloud/lib/private/DB/Connection.php:87
.... (stacktrace)

It does not work. I tried:

  • running as root, sudo -u nextcloud as above
  • running as root, sudo -u www-data
  • using another PHP version
    • php7.0 : this Nextcloud needs 7.3 at least
    • php7.3 : OC\HintException: [0]: Memcache \OC\Memcache\APCu not available for local cache (Is the matching PHP module installed and enabled?)
    • php7.4 as above
    • php without version, defaults to 7.4, so same result
  • with absolute path or relative path for both php and the data path, all 4 combinations
  • In some combination I got a warning about config.php being read only, but the option 'config_is_read_only' => true, is in the file.

I used the documentation at Nextcloud | Yunohost Documentation and Using the occ command — Nextcloud latest Administration Manual latest documentation

The best result is with php7.4; any idea why it gives a database driver error? How to continue?


Maybe that you should use php7.3 with option --define apc.enable_cli=1. So it should be something like sudo -u nextcloud php7.3 --define apc.enable_cli=1 /var/www/nextcloud/occ files:scan --path="wbk/files/".

Thanks, that made a difference! I have no idea what apc is, the closest match I found is List of PHP accelerators - Wikipedia. Is that correct?

At first it gave me a permissions-error,

Starting scan for user 1 out of 1 (wbk)
Exception during scan: opendir(/home/ Videos): failed to open dir: Permission denied

which was gone after # chown -R nextcloud:nextcloud /home/

# sudo -u nextcloud php7.3 --define apc.enable_cli=1 /var/www/nextcloud/occ files:scan --path="wbk/files/"
Starting scan for user 1 out of 1 (wbk)
| Folders | Files | Elapsed time |
| 198     | 5003  | 00:00:07     |

Thanks again!

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