Hi,
I am running nextcloud on a webhosting with a shell but without sudo rights. This keeps me away from running any OCC command and since I am running a newer NC instance, the OCC application is not working.
If I run the OCC command from shell without sudo I get:
Your data directory is invalid
Ensure there is a file called ".ocdata" in the root of the data directory.
Cannot create "data" directory
This can usually be fixed by giving the webserver write access to the root directory. See https://docs.nextcloud.com/server/22/go.php?to=admin-dir_permissions
An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /home/3d-sphere.com/sub/sylex.repository/lib/private/Console/Application.php:162
Stack trace:
#0 /home/3d-sphere.com/sub/sylex.repository/console.php(98): OC\Console\Application->loadCommands()
#1 /home/3d-sphere.com/sub/sylex.repository/occ(11): require_once('/home/3d-sphere...')
The .ocdata is present in the directory it is just not working. I have tried to follow the method of creating a php file with the occ command but it is not doing anything.
<?php
exec("/usr/bin/php7.4 -d memory_limit=1024M ../sylex.repository/occ db:add-missing-indices > occ-result.txt");
exec("echo \"Command completed!\" >> occ-result.txt");
header('Location: occ-result.txt');
?>
I get command complete but without any change. If I try to run the php file from the shell, I get the “Your data directory is invalid” as above. I am still not sure if the relative occ path is set right. The php file sits in a folder sub/occ. The nextcloud instance sits in sub/sylex.repository folder.
Any help would be appreciated, I have no idea how to solve this.
thx, tomas