Page 1 of 1

How to enable pcntl_fork

Posted: Sat Oct 09, 2021 1:04 am
by 6Mkfcbpwamxx
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?

Re: How to enable pcntl

Posted: Sat Oct 09, 2021 4:34 pm
by myVesta
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

Re: How to enable pcntl_fork

Posted: Mon Oct 11, 2021 12:31 am
by 6Mkfcbpwamxx
Thank you :)