How to enable exec() function in PHP-FPM

Date: 02-10-2021

Step 1: Log in to the server via SSH.

Step 2: Check the PHP version of the server by using the below command.
# php -v

Step 3: If your domain using PHP version 7.3, open the PHP-FPM configuration file.
# vi /opt/cpanel/ea-php73/root/etc/php-fpm.d/domainname.conf
Note: – domainname.conf – Your domain name config file.

Search the disabled function list in the config file and find the exec function.

php_admin_value[disable_functions] = exec,passthru,shell_exec,system

Step 4: Remove that exec function from the above line and keep like below.
php_admin_value[disable_functions] = passthru,shell_exec,system

Step 5: Restart the PHP-FPM service by using the below command and then exec function should works.
# /scripts/restartsrv_apache_php_fpm

Thank you!


Leave a Reply