Occ says it has no permission to access console.php, but it does

I’m installing Nextcloud from cmd on a headless server. I’ve installed and configured php, mariadb, and the apache webserver. Now I’m trying to use the oss command to install nextcloud itself:

nextcloud]$ sudo -u http php occ  maintenance:install --database='mysql' --database-name='nextcloud' --database-user='root' --database-pass='redactedl' --admin-user='admin' --admin-pass='redacted'

It fails with the following error:

PHP Warning:  require_once(/home/copperthief/nextcloud/console.php): Failed to open stream: Permission denied in /home/copperthief/nextcloud/occ on line 11
PHP Fatal error:  Uncaught Error: Failed opening required '/home/copperthief/nextcloud/console.php' (include_path='.:') in /home/copperthief/nextcloud/occ:11
Stack trace:
#0 {main}
  thrown in /home/copperthief/nextcloud/occ on line 11

However, I set the permissions of both console.php itself and the nextcloud folder to 777, so I know for sure they aren’t denying any user permission. (The whole nextcloud folder and everything inside is also owned by the http user.)

I’ve searched both these forums and general php resources, and tried a bunch of stuff, but nothing seems to change. There are people with similar issues but theirs were solved when they set the correct permissions, and I’m still stuck.

Any help would be much appreciated!

Usually the user’s folder aren’t readable by other users (and it doesn’t make sense to place such things inside user’s personal folders).

You can easily try with:

sudo -u http ls /home/copperthief/nextcloud

If you have a permission problem.

Hello,
I’ve got exactly the same problem.
But my nextcloud files are on an external harddisk.
Because I’m working on Debian, the Apache user is www-data and the whole directory tree belongs to www-data.
The Redis is running well, as Apache.
Where is the problem ?

Thanks in advance

So the ls command as user www-data works?

And the error message complains about the same path not being accessible?