How to Enable exec() in PHP-FPM?

Posted on August 17th, 2018

Sometimes the exec() function is not working after turning on the PHP-FPM and in php configuration file we could not find any disable functions. If we turned off the PHP-FPM the exec function is working again. If you are facing such issues, please follow the below steps.


First, you need to verify the PHP-FPM is enabled on the domain that facing the issue. Please follow the steps.

1) Login to WHM.

2) Navigate to MultiPHP Manager to check whether the domain is using PHP-FPM or not.

3) From that page, you can verify that the domain is using PHP-FPM.


Now you have verified that PHP-FPM is on the server. So you need to follow the steps to enable exec() in PHP-FPM.

1) Login to server via SSH.

2) Check the PHP version of the server using the below command.

#php -v

3) Then open the PHP-FPM configuration file.

# vi /opt/cpanel/ea-php70/root/etc/php-fpm.d/blah.domain.tld.conf

4) Then you will find the exec() function in the disabled function list.

php_admin_value[disable_functions] = passthru,shell_exec,system

5) Remove that from the above line.

6) Then restart PHP-FPM using the below command.

# /scripts/restartsrv_apache_php_fpm

Now exec() should works.


You can also do the same by following below steps.

1) Create the /var/cpanel/ApachePHPFPM directory using the below command:

# mkdir /var/cpanel/ApachePHPFPM

2) Create the /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml file

# touch /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml

3) Open the file /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml using your text editor (e.g. vi, nano) :

# vi /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml

add the function that you want to disable.

php_admin_value_disable_functions : passthru,system

In this example, “passthru,system” are left as disabled functions. No other lines exist before or after this entry in this file.

4) Regenerate the PHP-FPM configuration files via:

/scripts/php_fpm_config –rebuild


If you need any further assistance please contact our support department.



3 Responses to “How to Enable exec() in PHP-FPM?”

  1. penelope dias says:

    Great job as always

  2. Bragi Austfjord says:

    Not workin for my cpanel v82.0.16

    Any ideas.

    Best Regards

Leave a Reply