Recently upgraded PHP, I got 8.0 now and cron jobs don't run

Nextcloud version: 19.0.4
Operating system and version: Ubuntu 18.04.1
Apache version: 2.4.46
PHP version(s): Using 7.3.23 FPM for the Nextcloud server, but {5.6.40, 7.0.33, 7.1.33, 7.2.34, 7.3.23, 7.4.11, 8.0.0} are available.
Database version: MySQL 8.0.21

The issue you are facing:
The normal system cron job that has been reliably running for years has stopped working throwing this error:

This version of Nextcloud is not compatible with > PHP 7.4.
You are currently running 8.0.0rc1.

I manage my physical server with the Virtualmin system. You get to choose the particular version and style of PHP to run for each virtual server. Somehow the system cron is defaulting to the latest PHP installed, which until a few days ago was PHP 7.4.11, so now it’s failing to run because version 8.0.0 was released from the
http://ppa.launchpad.net/ondrej/apache2/ubuntu
and
http://ppa.launchpad.net/ondrej/php/ubuntu
repositories.

Is this the first time you’ve seen this error?: Yes

Steps to replicate it:

  1. Upgrade the system PHP to 8.0, or the latest via the Ondrej repository.
  2. Set https://sd.fqdn.tld/index.php/settings/admin in Nextcloud to use the “Cron” option.
  3. Try to run the system cron either
    manually (admin@server:~/www/html/nextcloud$ php cron.php)
    or via scheduled automation.
  4. Observe the error messages in https://sd.fqdn.tld/index.php/settings/admin/overview to see it’s failing to run.

The output of your config.php file in /path/to/nextcloud:

<?php
$CONFIG = array (
  'config_is_read_only' => false,
  'instanceid' => '78f789df7dfg7s',
  'passwordsalt' => 'j3448fjr8fuijwe4uwe894ja89034R789Z',
  'secret' => 'ilued7DEUIN34W89(*&d&*(RJK89FB(NCDLKL89dfhgfwk489',
  'trusted_domains' => 
  array (
    0 => 'sd.fqdn.tld',
  ),
  'datadirectory' => '/var/www/html/sd.fqdn.tld/svr/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '19.0.4.2',
  'dbname' => 'nextcloud',
  'dbhost' => '192.168.2.221',
  'dbport' => '',
  'dbtableprefix' => 'nc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'admin',
  'dbpassword' => 'PASSWORD1isHard',
  'installed' => true,
  'mail_from_address' => 'admin',
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_domain' => 'fqdn.tld',
  'mail_smtphost' => 'smtp.mailgun.org',
  'mail_smtpport' => '587',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'postmaster@mg.fqdn.tld',
  'mail_smtppassword' => 'd87sd6k3j(&*snj39ns8dn34j298sdx',
  'maintenance' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'theme' => '',
  'loglevel' => 0,
  'default_language' => 'en',
  'enable_previews' => true,
  'preview_max_x' => 2048,
  'preview_max_y' => 2048,
  'preview_max_scale_factor' => 10,
  'preview_max_filesize_image' => 50,
  'preview_libreoffice_path' => '/usr/bin/libreoffice',
  'preview_office_cl_parameters' => ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir ',
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\PNG',
    1 => 'OC\\Preview\\JPEG',
    2 => 'OC\\Preview\\GIF',
    3 => 'OC\\Preview\\BMP',
    4 => 'OC\\Preview\\XBitmap',
    5 => 'OC\\Preview\\SVG',
    6 => 'OC\\Preview\\TIFF',
    7 => 'OC\\Preview\\MP3',
    8 => 'OC\\Preview\\TXT',
    9 => 'OC\\Preview\\Font',
    10 => 'OC\\Preview\\MarkDown',
    11 => 'OC\\Preview\\Movie',
    12 => 'OC\\Preview\\MSOffice2003',
    13 => 'OC\\Preview\\MSOffice2007',
    14 => 'OC\\Preview\\MSOfficeDoc',
    15 => 'OC\\Preview\\OpenDocument',
    16 => 'OC\\Preview\\PDF',
    17 => 'OC\\Preview\\Postscript',
    18 => 'OC\\Preview\\StarOffice',
  ),
  'tempdirectory' => '/var/tmp/web/sd.fqdn.tld/nextcloudtemp',
  'overwrite.cli.url' => 'https://sd.fqdn.tld/',
  'updater.release.channel' => 'stable',
  'has_rebuilt_cache' => true,
  'allowNightlyUpdates' => 
  array (
    0 => 'passwords',
  ),
  'data-fingerprint' => '1de43145fde7ae7a0e662172b3f8331d',
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 0,
    'timeout' => 0.0,
    'password' => '',
  ),
  'updater.secret' => '&s89df79s898DF9DN*AS8DNRo8ifutjr443890890uv(*(&klcf23489vhf98d',
);

yes I did corrupt the sensitive data in that configuration

P.S.

Additional information:
If I run the cron job via the URL (for me it’s https://sd.fqdn.tld/cron.php), I get a success message:

Cache-Control: no-store, no-cache, must-revalidate
Connection: Upgrade, Keep-Alive
Content-Security-Policy: default-src 'self'; script-src 'self' 'nonce-<snip>='; style-src 'self' 'unsafe-inline'; frame-src *; img-src * data: blob:; font-src 'self' data:; media-src *; connect-src *; object-src 'none'; base-uri 'self';
Content-Type: application/json; charset=utf-8
Date: Wed, 14 Oct 2020 18:19:20 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive: timeout=5, max=100
Pragma: no-cache
Referrer-Policy: no-referrer
Server: Apache/2.4.46
Strict-Transport-Security: max-age=15552000; preload; includeSubDomains
Transfer-Encoding: chunked
Upgrade: h2,h2c
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-Robots-Tag: none
X-XSS-Protection: 1; mode=block

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.5
Connection: keep-alive
DNT: 1
Host: sd.fqdn.tld
Sec-GPC: 1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0

Alternative solution(s)
Until this type of problem gets resolved in a general way, I’ll be leaving my system set to Webcron instead of Cron.

Hi!

I had exactly the same issue. I solved it by changing my crontab via
sudo crontab -u www-data -e

from:
*/5 * * * * php -f /var/www/nextcloud/cron.php
to:
*/5 * * * * php7.3 -f /var/www/nextcloud/cron.php

So it’s not using PHP8 anymore.

BR

3 Likes

@ruppscloudadmin

This version of Nextcloud is not compatible with > PHP 7.4.
You are currently running 8.0.0rc1.

so what do you expect?

Because Virtualmin lets you say which version to use in the virtual server, and I had 7.4 selected for my Nextcloud and Collabora, I assumed it would pick that for events related to that virtual server.