Raspberry Pi - absolutely no chance to run cron.php

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 12.0.2): 14
Operating system and version (eg, Ubuntu 17.04): Raspbian
Apache or nginx version (eg, Apache 2.4.25): Apache2
PHP version (eg, 7.1): PHP 7.0

The issue you are facing:

Is this the first time you’ve seen this error? (Y/N): N

Steps to replicate it:

  1. every way how to access cron.php by www-data

The output of your Nextcloud log in Admin > Logging:


The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):


The output of your Apache/nginx/system log in /var/log/____:


I cannot run cron.php for nothing. I did everything I could find out about this problem.
My file is in /var/www/html/nextcloud/cron.php
I have created a cronjob correctly.
When I put in “sudo crontab -u www-data -e” it opens the file with cronjobs for user www-data. There the last line is:
0,15,30,45 * * * * wget https://mattzel820.ddns.net/nextcloud/cron.php
Before it was the local path, both ways dont work.
So I checked if I can run the file normally als www-data. I cannot
I changed permissions for the file by chmod and the folder ownership both to www-data. I tried open the file by www-data over local path, my IP/nextcloud/cron.php and over my domain/nextcloud/cron.php
Every time. Every time! I see

Could not open input file: /var/www/html/nextcloud/cron.php
Cannot write to ‘cron.php’ (Permission denied)
What else can I do? I think I tried everything I can, this problem is killing me, because I just created the cronjob and now even AJAX doesnt work, when I try to revert.
I mean if www-data has all permissions to even the folders above, how cannot it run the file?
I checked if www-data is the correct owner of the folder where the file is and it is indeed, so there isnt the problem. I can open the file normally, but I cannot open it as www-data. I just cannot

How come you configured
wget https://.... ?

The documentation (https://docs.nextcloud.com/server/14/admin_manual/configuration_server/background_jobs_configuration.html?highlight=cron#cron) reads:

# crontab -u www-data -e
*/15  *  *  *  * php -f /var/www/nextcloud/cron.php

So your cron job should look like:
*/15 * * * * php -f /var/www/html/nextcloud/cron.php

What happens when you run:
sudo -u www-data php -f /var/www/html/nextcloud/cron.php
manually? Any error messages?

1 Like