Hestia User Moodle Cron stopped working

Friends,

I have two different Hestia Servers both using Debian 11. On each I created a Hestia user with PHP 8.1 CLI. On each, about one year ago, I installed a domain with SSL for each user in which I installed a Moodle educational website using PHP 8.1. The final step of installing Moodle is creating a cron job to keep everything up to date.

In each user account, I clicked on CRON, Add Cron Job. The cron jobs worked perfectly until November 27, 2023. At almost exactly the same time, both cron jobs stopped working and have not worked ever since. I did not notice this problem until two weeks ago when I was updating the Moodle version on each site. I have spent the past two weeks trying to resolve this problem.

I read in the Hestia forum a post on Nov 23 2023 that described the exact Moodle cron problem I have. Here is the link:

Here was the error:

If I try to run cron.php script manually I get:

!!! ExcepciĂłn - Call to undefined function pcntl_signal() !!!

Here was the solution:

I managed to solve it. I just had to remove pcntl_signal from the php.ini

(Unfortunately, the poster did not explain how to remove pcntl_signal from the php.ini )

Then on Dec 23, 2023, a person asked how to install php pcntl. Here is the link:

A person gave the following advice. (which explained how to remove pcntl_signal from the php.ini )

You should edit the php.ini for the PHP version you are using:

Example using php 8.1:

Edit files:

/etc/php/8.1/cli/php.ini

/etc/php/8.1/fpm/php.ini

And remove pcntl_signal from disable_functions directive

Before:

disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority

After:

disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority

Once done, restart php 8.1:

systemctl restart php8.1-fpm

I am hoping I can solve my Moodle Cron problem by removing pcntl_signal from disable_functions directive.

However, I went to edit files:

/etc/php/8.1/cli/php.ini

/etc/php/8.1/fpm/php.ini

and neither of these files has a section called disable_functions!

Both files are 2000 lines long. I looked carefully at both three times with no luck.

I am hoping someone can help me solve this problem and also let me know if there is any drawbacks to removing pcntl_signal from disable_functions directive.

1 Like

Hi @David-Spring,

Could you please show the output of these commands (as root)?

php -v
php -i | grep -iE 'disable_functions|pcntl'
grep -riE 'disable_functions|pcntl' /usr/local/hestia/data/templates/web /etc/php
1 Like
php -v
PHP 8.1.21 (cli) (built: Jul 16 2023 11:00:45) (NTS)
php -i | grep -iE 'disable_functions|pcntl'

disable_functions => pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority => pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority
pcntl
pcntl support => enabled
grep -riE 'disable_functions|pcntl' /usr/local/hestia/data/templates/web /etc/php

/etc/php/8.1/fpm/php.ini:disable_functions =
/etc/php/8.1/fpm/pool.d/www.conf.dpkg-dist:; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
/etc/php/8.1/fpm/php.ini.ucf-dist:disable_functions =
/etc/php/8.1/cli/php.ini:disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority
/etc/php/8.1/cli/php.ini.ucf-dist:disable_functions =
/etc/php/7.4/fpm/php.ini:disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,system,passthru,shell_exec,proc_open,popen
/etc/php/7.4/cli/php.ini:disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority

Thank you for your help in solving this problem!

1 Like

As root execute this command to remove function pcntl_signal from directive disable_functions for PHP 8.1 CLI

sed -i -E 's/(^disable_functions.*),pcntl_signal(.*$)/\1\2/' /etc/php/8.1/cli/php.ini

Once done, try to run the cron job again.

2 Likes

Thank you. That solved the problem!

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.