Cron error

Cron error

by Sachin G -
Number of replies: 9
Hi, 

I'm new to Moodle, receiving error when running cron (php admin\cli\cron.php) 

Moodle version: 4.2.2 

Error info: 

Server Time: Fri, 15 Sep 2023 13:04:01 +0530



Execute scheduled task: Cleanup old sessions (core\task\session_cleanup_task)

!!! Exception - Class 'IntlTimeZone' not found !!!


Debug info:

Error code: generalexceptionmessage

Stack trace: * 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 920 of \lib\classes\date.php: call to preg_replace_callback()

* line 2380 of \lib\moodlelib.php: call to core_date::strftime()

* line 327 of \calendar\type\gregorian\classes\structure.php: call to date_format_string()

* line 2321 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()

Average of ratings: -
In reply to Sachin G

Re: Cron error

by Renaat Debleu -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
Did you install the php-intl extension?

You can check your Moodle environment (Site administration > Server > Environment) and see if there are no extensions missing.
In reply to Renaat Debleu

Re: Cron error

by Sachin G -
Hi, 

This php-intl extension is already enabled.
In reply to Sachin G

Re: Cron error

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Is the php-intl extension enabled for both webserver and CLI versions of PHP?

You can have different configurations for when PHP is called in the two different ways (even different versions of PHP itself).
In reply to Sachin G

Re: Cron error

by Dominique Palumbo -
Picture of Plugin developers
Hi,

Did you check what time zone is configured in Moodle (config.php) ?

ie:
date_default_timezone_set('Australia/Hobart');

Maybe they've a mispelling. But I'm not sure it can cause that error.

Have a nice day.

Dominique.
In reply to Dominique Palumbo

Ri: Re: Cron error

by Francesco Garganese -
Hi,
I have the same error.
In my config.php there is no timezone specification.
Trying to insert it the result doesn't change.
In reply to Sachin G

Re: Cron error

by Administrador Moodle (Daniel Felipe Raigoza) -
Hello, how do I solve it? I'm getting the same error and it won't even let me access the platform.

In reply to Administrador Moodle (Daniel Felipe Raigoza)

Re: Cron error

by Jaswant Tak -
This could be due to Calendar module, try to disable Calendar block from admin and see if it works

/admin/blocks.php

Regards
In reply to Administrador Moodle (Daniel Felipe Raigoza)

Re: Cron error

by Sean Marx -
Picture of Testers
Hi

I know this is a bit old, but posting anyway. I may help the next person coming to this thread.

I had the same issue with Moodle 4.3.3

Error:
Execute scheduled task: Cleanup old sessions (core\task\session_cleanup_task)
!!! Exception - Class "IntlTimeZone" not found !!!



I first checked the below:
All extensions were present in the server/environment tab
I made sure extension=intl was enabled in php.ini
I added the timezone value in config.php

None of the above worked. I then ran the following command and it fixed the issue for me.

sudo apt-get install -y php-intl


Full trace from install of php-intl:
# sudo apt-get install -y php-intl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
php8.1-intl
The following NEW packages will be installed:
php-intl php8.1-intl
0 upgraded, 2 newly installed, 0 to remove and 24 not upgraded.
1 not fully installed or removed.
Need to get 144 kB of archives.
After this operation, 522 kB of additional disk space will be used.
Get:1 http://mirror.hetzner.com/ubuntu/packages jammy-updates/universe amd64 php8.1-intl amd64 8.1.2-1ubuntu2.15 [142 kB]
Get:2 http://mirror.hetzner.com/ubuntu/packages jammy/universe amd64 php-intl all 2:8.1+92ubuntu1 [1,840 B]
Fetched 144 kB in 0s (9,815 kB/s)
Selecting previously unselected package php8.1-intl.
(Reading database ... 220154 files and directories currently installed.)
Preparing to unpack .../php8.1-intl_8.1.2-1ubuntu2.15_amd64.deb ...
Unpacking php8.1-intl (8.1.2-1ubuntu2.15) ...
Selecting previously unselected package php-intl.
Preparing to unpack .../php-intl_2%3a8.1+92ubuntu1_all.deb ...
Unpacking php-intl (2:8.1+92ubuntu1) ...
Setting up update-notifier-common (3.192.54.8) ...
Traceback (most recent call last):
File "/usr/lib/update-notifier/package-data-downloader", line 24, in import debian.deb822
ModuleNotFoundError: No module named 'debian'
dpkg: error processing package update-notifier-common (--configure):
installed update-notifier-common package post-installation script subprocess returned error exit status 1
Setting up php8.1-intl (8.1.2-1ubuntu2.15) ...

Creating config file /etc/php/8.1/mods-available/intl.ini with new version
Setting up php-intl (2:8.1+92ubuntu1) ...
Processing triggers for libapache2-mod-php8.1 (8.1.2-1ubuntu2.15) ...
Processing triggers for php8.1-fpm (8.1.2-1ubuntu2.15) ...
NOTICE: Not enabling PHP 8.1 FPM by default.
NOTICE: To enable PHP 8.1 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php8.1-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
Processing triggers for php8.1-cli (8.1.2-1ubuntu2.15) ...
Processing triggers for php8.1-cgi (8.1.2-1ubuntu2.15) ...
Errors were encountered while processing:
update-notifier-common
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
In reply to Sean Marx

Re: Cron error

by Fido Dido -

Thanks a lot.

I run sudo apt-get install -y php-intl and it works fine.

It was the source of many other erros, all works fine now.