How can I enable shell_exec?

Hello. Please, friends and experienced people, help me solve this problem that is exhausting me. How can I enable shell_exec?

shell_exec() has been disabled for security reasons, please contact your host provider to enable it.
shell_exec is required to enable this system.

Hi,

Keep in mind that enabling shell_exec could be a security risk.

Edit the php.ini file for your php version and mode (cli and/or fpm) and remove shell_exec from disable_functions directive.

Example for php 8.2 version:

CLI: /etc/php/8.2/cli/php.ini

FPM: /etc/php/8.2/fpm/php.ini

Before removing shell_exec:

disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pc
ntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtim
edwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,system,passthru,shell_exec,proc_open,popen

After:

disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pc
ntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtim
edwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,system,passthru,proc_open,popen

After that, restart php service.

systemctl restart php8.2-fpm

1 Like

Thank you for the quick response. Please, where is the option or place in hestiacp to modify it?

Server settings → Edit the php service (use the pencil icon shown when hovering the service name) → Advanced options (here you can modify php.ini file) and once done → Save

2 Likes

The problem was solved successfully. Thank you, my friend, for helping me.

1 Like

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