HoganHost blog

[email protected]

How to Enable exec() in PHP-FPM?

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 this from your cpanel end if you can’t reach out to your hosting provider’s


To enable exec() function, you need to remove it from the following line in your php.ini file:

disable_functions = “show_source, system, shell_exec, exec”

1. Open your php.ini and find the following section:

2. Remove exec from the line and click on Save Changes:

3. If you need to disable show_sourcesystem or shell_exec as well, just add them back to the line and save the changes.

That’s it!

Leave a Comment

Your email address will not be published.