Cron.php / Uncaught Error: Call to a member function getLogger() on null

Nextcloud version (eg, 20.0.5): 20.0.8
Operating system and version (eg, Ubuntu 20.04): shared host (CPanel), Kernel: 3.10.0-1160.6.1.el7.x86_64 x86_64
Apache or nginx version (eg, Apache 2.4.25): 2.4.46
PHP version (eg, 7.4): 7.4.16

The issue you are facing:

cron.php uncaught error (see “Logs” below)


I’ve added Nextcloud’s cron.php as a cron job (every minute !):

* * * * * php -f /home/SECRET_PATH/public_html/nextcloud/cron.php

After that in “Admin / Settings / Administration / Basic Settings / Background jobs” I’ve changed the options to “Cron”.

After that I get this message:

Last job execution ran 55 minutes ago. Something seems wrong.

On the host if a cron job produce an output, the system (CPanel) sends me an email with the output.

To make sure that the cron.php is called I wrote an echo "hello"; in the cron.php right below <?php and I started getting email with “hello” every minute.

So the cron.php is called every minute, but the Last job execution... error message still there on the web UI.

I’ve moved the echo "hello"; to different places in cron.php and it seems to me if I put the echo after require_once __DIR__ . '/lib/base.php'; the execution never reach the echo "hello";


 * @copyright Copyright (c) 2016, ownCloud, Inc.
 * @author Artem Sidorenko <>
 * @author Christopher Schäpers <>
 * @author Christoph Wurst <>
 * @author Damjan Georgievski <>
 * @author Daniel Kesselberg <>
 * @author Jakob Sack <>
 * @author Joas Schilling <>
 * @author Jörn Friedrich Dreyer <>
 * @author Ko- <>
 * @author Michael Kuhn <>
 * @author Morris Jobke <>
 * @author Oliver Kohl D.Sc. <>
 * @author Robin Appelman <>
 * @author Roeland Jago Douma <>
 * @author Steffen Lindner <>
 * @author Thomas Müller <>
 * @author Vincent Petry <>
 * @license AGPL-3.0
 * This code is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * GNU Affero General Public License for more details.
 * You should have received a copy of the GNU Affero General Public License, version 3,
 * along with this program. If not, see <>

require_once __DIR__ . '/lib/versioncheck.php';

try {
	require_once __DIR__ . '/lib/base.php';

echo "hello";


This is a shared host server (CPanel) so everything is running with a same user


error_log content after cron.php executed:

[02-Apr-2021 16:54:01 UTC] PHP Fatal error:  Uncaught Error: Call to a member function getLogger() on null in /home/SECRET_PATH/public_html/nextcloud/cron.php:163
Stack trace:
#0 {main}
  thrown in /home/SECRET_PATH/public_html/nextcloud/cron.php on line 163


What is going on? How can debug this issue?

This led me to the solution: Cronjob is not working by an issue with php - #14 by kriszy

in my case:

* * * * *  /usr/local/bin/ea-php74 -f /home/SECRET_PATH/public_html/nextcloud/cron.php