How to enable pcntl_fork

Post Reply
6Mkfcbpwamxx
Posts: 2
Joined: Sat Oct 09, 2021 12:59 am

Good afternoon, when working with one php script, I get an error "Call to undefined function pcntl_fork()". I understand that it is necessary to enable pcntl? How to do it?

Tags:
User avatar
myVesta
Site Admin
Posts: 928
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 8 times
Been thanked: 6 times

it's probably disabled in /etc/php/7.3/fpm/php.ini due security reasons.

Code: Select all

# grep 'pcntl_fork' /etc/php/7.3/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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,exec,system,passthru,shell_exec,proc_open,popen

Remove that function from that line and restart php-fpm:

Code: Select all

systemctl restart php7.3-fpm
6Mkfcbpwamxx
Posts: 2
Joined: Sat Oct 09, 2021 12:59 am

Thank you :)
Post Reply