Cron Misconfiguration

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:

example

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

longer
example
here

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, 20.0.5): Nextcloud Hub 3 (25.0.1)
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.41 (Ubuntu)
PHP version (eg, 7.4): 7.4.3

The issue you are facing:
Overview mentions cron configuration as seen below. I have appended some config to config.php as stated in instructions but still shows. I believe the folder is owned correctly. Thanks

Is this the first time you’ve seen this error? (Y/N): N it has been there since beginning

The output of your Nextcloud log in Admin > Logging:

A lot of Identifiable information here?

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

<?php
$CONFIG = array (
  'instanceid' => 'xxxxxxxxxx',
  'passwordsalt' => 'xxxxxxxxxx',
  'secret' => '',
  'trusted_domains' => 
  array (
    0 => 'xxxxxxxxxx',
  ),
  'datadirectory' => '/var/www/nextcloudxxxxxxxxx/data',
  'dbtype' => 'mysql',
  'version' => '25.0.1.1',
  'overwrite.cli.url' => 'https://xxxxxxxxxx',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxxxxxxxxx',
  'dbpassword' => 'xxxxxxxxxx',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'default_phone_region' => 'UK',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'xxxxxxxxxx',
  'mail_domain' => 'xxxxxxxxxx',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'app_install_overwrite' => 
  array (
    0 => 'files_external_sia',
    1 => 'backup',
    2 => 'breezedark',
  ),
  'twofactor_enforced' => 'true',
  'twofactor_enforced_groups' => 
  array (
    0 => 'xxxxxxxxxx',
    1 => 'xxxxxxxxxx',
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
  ),
  'maintenance_window_start' => 1,
);

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

PASTE HERE

Please let me know what else you need to help. Thanks

i am not sure about your memory cache configuration,
Comment the " ‘memcache.local’ => ‘\OC\Memcache\APCu’, " line, reload apache2, check it again & let me know

Hi, That appears to have broken the server. I have reverted the change.

at the moment did you check /var/log/apache2/error.log ?

image

ok i have done the above?

oh I like this log! showing syntax error for default phone region.

[php7:error] [pid 20014] [client x.x.x.x.:52638] PHP Parse error: syntax error, unexpected ‘‘default_phone_region’’ (T_CONSTANT_ENCAPSED_STRING), expecting ‘)’ in /var/www/next

what would be UK’s? i have tried UK, en, gb (in those case’s)

but cant see much to do with why the internal server error

there is this error…
[access_compat:error] [pid 18115] [client x.x.x.x:52277] AH01797: client denied by server configuration: /var/www/nextcloud**********/data/.ocdata

No Dear!
by comment the line i meant to make it deny to compile !
just add // before the line ( the line color should change then)

1 Like

proper way to add region configuration is:

‘default_phone_region’ => ‘<+44>’,

1 Like

ah right ! ok. Learning :slight_smile:

Its commented out and working. Also think phone error has gone. Thanks! Now seeing this in overview messages…

1 Like

which type of Cron does your server use?
Ajax must work with the recent configuration, if you insist on using APCu please write your crontab for permitted user

Do you mean this?

Yes

no sure i understand that ^. This will be used by 5 people when ready. Is the below correct or should be owned by root? i tried this but no change.

-rw-rw---- 1 www-data www-data 6317 Nov 3 11:14 /var/www/nextcloud/cron.php

aha, number of your clients isn’t large enough to justify to use APCU, however you can configure your server to use APCu by letting root user runs the job.
Append following line to your php.ini

       --define apc.enable_cli=1

in other case select AJAX instead & reload everything

i have this but still shows the same error on overview

I would like to use cron instead of ajax, over time users will likely grow.

The proper way of adding a phone region is to use ISO 3166-1 country codes such as DE for Germany, FR for France, etc …

See the ISO 3166-1 alpha-2 code list to find the correct code for your country.

Open the crontab of the user www-data…

crontab -u www-data -e

…and paste the following line: (change the path to your actual Nextcloud folder)

*/5 * * * * php -f /var/www/html/nextcloud/cron.php 

Save the file, exit nano and enable the cronjob in Nextcloud:

sudo -u www-data php /var/www/html/nextcloud/occ background:cron

About the --define apc.enable_cli=1 option: I would recommand to add it to the apcu.ini file, because it’s related to, you guessed it, apcu. :wink: You can either add it by running the following command as root:

sed -i '$aapc.enable_cli=1' /etc/php/7.4/mods-available/apcu.ini

or open the file manually:

sudo nano /etc/php/7.4/mods-available/apcu.ini

and then add the following line:

apc.enable_cli=1
1 Like

Thanks for helping to.

so i have this now but still cron red error in overview.