Cron errors

Cron errors

by Dennis Fulton -
Number of replies: 15
Moodle 4.3.2
Ubuntu Linux 22.04

I noticed the notification that cron had not run in six days.  I did a manual cron php admin/cli/cron.php and received this output:

-------------SNIP-------------
Execute scheduled task: Site registration (core\task\registration_cron_task)
Default exception handler: Exception - Class "IntlTimeZone" not found Debug:
Error code: generalexceptionmessage
* line 755 of /lib/classes/date.php: Error thrown
* line 906 of /lib/classes/date.php: call to core_date::{closure}()
* line ? of unknownfile: call to core_date::{closure}()
* line 887 of /lib/classes/date.php: call to preg_replace_callback()
* line 2390 of /lib/moodlelib.php: call to core_date::strftime()
* line 327 of /calendar/type/gregorian/classes/structure.php: call to date_format_string()
* line 2331 of /lib/moodlelib.php: call to calendartype_gregorian\structure->timestamp_to_date_string()
* line 561 of /lib/classes/cron.php: call to userdate()
* line 388 of /lib/classes/cron.php: call to core\cron::set_process_title()
* line 208 of /lib/classes/cron.php: call to core\cron::run_inner_scheduled_task()
* line 125 of /lib/classes/cron.php: call to core\cron::run_scheduled_tasks()
* line 186 of /admin/cli/cron.php: call to core\cron::run_main_process()

!!! Exception - Class "IntlTimeZone" not found !!!
PHP Fatal error:  Uncaught Error: Call to a member function real_escape_string() on null in /var/www/html/maolonline/moodle/lib/dml/mysqli_native_moodle_database.php:1265
Stack trace:
#0 /var/www/html/maolonline/moodle/lib/dml/mysqli_native_moodle_database.php(1394): mysqli_native_moodle_database->emulate_bound_params()
#1 /var/www/html/maolonline/moodle/lib/dml/moodle_database.php(1683): mysqli_native_moodle_database->get_records_sql()
#2 /var/www/html/maolonline/moodle/lib/classes/lock/mysql_lock_factory.php(144): moodle_database->get_record_sql()
#3 /var/www/html/maolonline/moodle/lib/classes/lock/lock.php(100): core\lock\mysql_lock_factory->release_lock()
#4 /var/www/html/maolonline/moodle/lib/classes/lock/lock.php(114): core\lock\lock->release()
#5 [internal function]: core\lock\lock->__destruct()
#6 {main}
  thrown in /var/www/html/maolonline/moodle/lib/dml/mysqli_native_moodle_database.php on line 1265

-------------END SNIP--------

Looks like a number of errors.  Any suggestions on how to run these down?
Average of ratings: -
In reply to Dennis Fulton

Re: Cron errors

by Ken Task -
Picture of Particularly helpful Moodlers
Looks like issues with timezone ... does your server need an operating system update to tzdata?
Did you upgrade the site 6 days ago?
If we did, did we follow docs for upgrading site?
Do we have php-intl extension and any other php extension related to dates?

'SoS', Ken

In reply to Ken Task

Re: Cron errors

by Dennis Fulton -
Strange... site has been running for sometime, but I did do an update about six days ago smile.....  I reinstalled php-intl and seems to be happy now...
In reply to Dennis Fulton

Re: Cron errors [RESOLVED]

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
> I reinstalled php-intl and seems to be happy now...

How did you install without php-intl? Moodle complains during installation. Or, have you uninstalled php-intl after installing?
In reply to Visvanath Ratnaweera

Re: Cron errors [RESOLVED]

by Dennis Fulton -
That is a very good question.  We have been running 4.3 for several months.  I did an apt update and apt upgrade on the OS when I upgraded to 4.3.2.  Something in that upgrade must have messed up the PHP modules.  That is the only thing I can think of that would have happened.
In reply to Dennis Fulton

Re: Cron errors

by Dennis Fulton -
I may have more going on than I thought. In Moodle - Admin - Server - PHP - Shows PHP Version 8.2.15. When I do a php -v command it shows: "Zend Engine v4.3.2, Copyright (c) Zend Technologies with Zend OPcache v8.3.2-1+ubuntu22.04.1+deb.sury.org+1, Copyright (c), by Zend Technologies"

Ubuntu says 8.3 and Moodle says 8.2.... could this be the problem?
In reply to Dennis Fulton

Re: Cron errors

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
> Moodle - Admin - Server - PHP - Shows PHP Version 8.2.15

That is the PHP that is linked to the web server, we call it PHP CGI, that is what Moodle sees too.

> php -v command it shows

That is the CLI PHP, for example what the crontab '* * * * * php /path/to/moodle/admin/cli/cron.php' would see.

BTW this is what I see in a Debian 12:
$ php -v
PHP 8.2.7 (cli) (built: Jun 9 2023 19:37:27) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.7, Copyright (c) Zend Technologies
with Zend OPcache v8.2.7, Copyright (c), by Zend Technologies
In reply to Visvanath Ratnaweera

Ri: Re: Cron errors

by Sergio Rabellino -
Picture of Particularly helpful Moodlers Picture of Plugin developers
This is ubuntu, instead. Recently apt-get update suggests php8.3 too, but probably does not override completely php8.2.
Anyway, Dennis could you open a cli and write down PHP and then (so system will show all the commands that starts with php) You should have (almost) php, php8.2 and php8.3 and the first one, should be the same of the latest.
In reply to Dennis Fulton

Re: Cron errors

by Ken Task -
Picture of Particularly helpful Moodlers
Uhhh ... I'd say yes, that's a problem.
php-cli (for command line) and php (for web) versions should be the same.
Got cPanel?
Look in cPanel for a php version tool per domain.   That's also where one sets php extensions to load per domain.

'SoS', Ken

In reply to Ken Task

Re: Cron errors

by Dennis Fulton -
No cPanel...
In reply to Dennis Fulton

Re: Cron errors

by Ken Task -
Picture of Particularly helpful Moodlers
Would you be interested in a panel for some things?
If so:

I have first hand knowledge of Webmin but not Cockpit.

One of the nice things about Webmin (maybe Cockpit has this feature also) is a Terminal.

'SoS', Ken
In reply to Ken Task

Re: Cron errors

by Dennis Fulton -
It was the issue of 8.3 on the server and 8.2 on apache2 side.  I removed PHP 8.3 and now we are happy.  Cron is running nicely and the backup files that were stuck, and now gone.  I still do not remember installing PHP 8.3.  Issue solved!  Thanks for the help.
In reply to Dennis Fulton

Re: Cron errors

by Ken Task -
Picture of Particularly helpful Moodlers
"I still do not remember installing PHP 8.3."

You might not have done it on purpose ...
you said you did an OS upgrade (from what to what?) ... could have happened then and didn't notice until issues with cron.

'SoS', Ken
 
In reply to Ken Task

Re: Cron errors [RESOLVED]

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators

>>>" I still do not remember installing PHP 8.3."

If PHP 8.3 would have been the default PHP version of Ubuntu Linux 22.04, one would think an 'apt full-upgrade' could have upgraded PHP. But that is not the case. The default is PHP 8.2.

Morale: If your system software does things of its own, Moodle won't like it! I repeat: Then it is not a Moodle problem. Forensics on what you could have done to cause this problem is not our business. Matter CLOSED!

In reply to Ken Task

Re: Cron errors

by Dennis Fulton -
Here is the cron output now with the changes:
---------------SNIP-------------------
root@m43:/var/www/html/maolonline/moodle# php admin/cli/cron.php
Server Time: Tue, 13 Feb 2024 12:47:29 +0000


Execute scheduled task: Site registration (core\task\registration_cron_task)
... started 12:47:29. Current memory use 20.7 MB.

--------------------END SNIP----------------------
In reply to Dennis Fulton

Ri: Re: Cron errors

by Sergio Rabellino -
Picture of Particularly helpful Moodlers Picture of Plugin developers
From the evidences, you should have two version of PHP installed, a 8.3 which is linked as "php" in the system and a 8.2 which is used by your webserver.
Obviously, you should double check that either php version have the needed package for moodle purposes using apt list --installed ...