Run OCC Command

Im trying to run the occ command to scan all my files after manually adding them to the server following these instructions

First give permissions:

chown -R www-data:www-data /mnt/Data/Cloud/admin/files/Memories/

cd /var/lib/docker/volumes/nextcloud_aio_nextcloud/_data/

sudo -u www-data php occ files:scan --all

but i get the following error
PHP Warning:  require_once(/var/lib/docker/volumes/nextcloud_aio_nextcloud/_data/console.php): Failed to open stream: Permission denied in /var/lib/docker/volumes/nextcloud_aio_nextcloud/_data/occ on line 11
PHP Fatal error:  Uncaught Error: Failed opening required '/var/lib/docker/volumes/nextcloud_aio_nextcloud/_data/console.php' (include_path='.:/usr/share/php') in /var/lib/docker/volumes/nextcloud_aio_nextcloud/_data/occ:11
Stack trace:
#0 {main}
  thrown in /var/lib/docker/volumes/nextcloud_aio_nextcloud/_data/occ on line 11

Can anyone help me with this.

try this:
sudo -u www-data php /var/www/nextcloud/occ files:scan --all

in verbose mode
sudo -u www-data php /var/www/nextcloud/occ files:scan --all -v

Could not open input file: /var/www/nextcloud/occ

If Nextcloud is running in a docker, you will need to run occ in the docker instance.

docker exec -u www-data -it nextcloud php occ <command>

(maybe you will need to add the path to the occ-command inside docker)


1 Like

It could also be possible that you have to give the occ-command execution privileges like

# chmod +x /var/www/nextcloud/occ