I get a problem when I want to run cron.php with in nextcloud docker

I have installed nexcloud using casa os. with the latest version. but when I run the corn.php file via CLI I only get an error message in the form of


I use the built-in storage space from casas os. and I use merge tools from casa os.


I don’t know how to correct it anymore. I ask for help.

I do not use CasaOS. But maybe you must use for Host and Container the subdir data where the Nextcloud data and .ocdata is stored. Add /data.

Yes I use casa os for hosting and container for docker. All installations went smoothly and there were already /data and .ocdata folders in the file, I had used docker php but after I ran it using the CLI, what happened was that the program never stopped running then I pressed ctrl + c to end the command.

Please provide the exact command line you’re using to run cron.php. It would also be helpful if you posted the output of occ config:list system (or equivalent, adapted to your environment).

root@jsjjsiwbaj:/DATA/AppData/nextcloud/var/www/html# php cron.php

Your data directory is invalid.
Ensure there is a file called “.ocdata” in the root of the data directory.

I use that command for run cron.php

But when i use www-data this happend

root@jsjjsiwbaj:/DATA/AppData/nextcloud/var/www/html# sudo -u www-data php cron.php
{"reqId":"dJ71Nslt4iNAJgXfZpxO","level":3,"time":"2024-07-26T12:52:39+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fopen(/var/www/html/data/data_dir_writability_test_66a39c17994c8.tmp): Failed to open stream: Permission denied at /DATA/AppData/nextcloud/var/www/html/lib/private/legacy/OC_Util.php#572","userAgent":"--","version":"29.0.4.1","data":{"app":"PHP"}}
Your data directory is invalid.
Ensure there is a file called ".ocdata" in the root
of the data directory.
Your data directory is not writable.
Permissions can usually be fixed by giving the web server write access to the root directory. See https://docs.nextcloud.com/server/29/go.php?to=admin-dir_permissions.
{"reqId":"dJ71Nslt4iNAJgXfZpxO","level":3,"time":"2024-07-26T12:52:39+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fopen(/var/www/html/data/nextcloud.log): Failed to open stream: Permission denied at /DATA/AppData/nextcloud/var/www/html/lib/private/Log/File.php#82","userAgent":"--","version":"29.0.4.1","data":{"app":"PHP"}}

It looks like the problem is you’re running cron.php on your host. It needs to be ran in your Nextcloud container, not your host.