Error in Crontab


I have an error with the NextCloud crontab, i.e. it tells me that I have an error when running the crontab.

When I look at the logs I get this:

And my file is the following:

Does the user “www-data” really exist? - On raspberrypi it might be a different name (“www” etc.).

Yes, there is

Hi @jordand

These are not error messages. They are just normal messages, telling you that the user www-data opened a pam_session, executed Nextcloud’s cron.php and then closed the session again.

ah okay but nextcloud tells me that an error occurred via the crontab, I will try to replace php with its executable with the correct version

I tried to put it in crontab but it still doesn’t work:

*/5  *  *  *  * /var/run/php/php7.4-fpm.sock -f /var/www/

Try the following:

*/5  *  *  *  * /usr/bin/php7.4 -f /var/www/

If that dosen’t work, please post the error message from the Nextcloud log here.

Sounds like PHP is not running in the CLI, are you using APCu by any chance?

I have an error:

and as root I have this message:

root@raspberrypi:/home/pi# /usr/bin/php7.4 -f /var/www/
Console has to be executed with the user that owns the file config/config.php
Current user id: 0
Owner id of config.php: 33

Aaah, that makes sense.

Delete those lines from cron, and recreate a user crontab instead.

$sudo crontab -e -u www-data
This will create a crontab file that will run as user www-data

I hope this works for you

I deleted the line from the cruntab file and redid it with the command you gave me but it still doesn’t work.

How can I see the error which occurred during the crontab

By default on linux, you would be able to see the output of cron on using:

#grep CRON /var/log/syslog

Can you confirm that php can run in the cli on your system?
Try running occ from your nextcloud directory (to confirm that php works from the command line)

#sudo -u www-data php occ


Here is a screen of my Syslog:

I have this error when I am executing this command:

sudo -u www-data php occ

I specify that these errors were not present before I installed PHP 8 on my Raspberry (on my vhost I specified php7-4)


This is a different error then.

It has nothing to do with crontab and everything to do with upgrading to PHP8.

First you’ll need to make sure that you reinstall all the necessary PHP modules that are missing, as reported in your error from occ.

Make sure all the modules listed here are installed.

Then, you may have to update parts of your configuration and crontab to point to PHP8 instead of 7.4.

Good luck, will check back tomorrow.

1 Like

Indeed I remodeled my Nextcloud so now it runs without problem on PHP 8 but I have an error that tells me that the memory value of PHP 8.0 is not large enough at 512 MB
but if you want i edited the value on my php.ini yet i still have the error.

and I have also this error: PHP does not seem to be configured to retrieve environment variable values. Testing the getenv(“PATH”) command only returns an empty response. Please consult the installation documentation for information on how to configure PHP on your server, especially when using php-fpm.

I would suggest reverting to PHP7.4 and then going step-by-step with all the procedures to get PHP8 working correctly.

Consult the documentation for RaspberryPi OS (I assume Debian documentation will work) and Apache. There are a number of configuration options that need to be changed to get things working properly.

Follow the instructions alongside the nextcloud server installation guide to make sure you get everything correct. There are too many settings to mention here in this forum.

Best luck.