How to Enable exec() in PHP-FPM

In this guide, we’ll show you how to enable exec() in PHP-FPM. Sometimes, the exec() function stops working after PHP-FPM is turned on, even if there are no disabled functions in the PHP configuration file. However, you can make exec() work again by disabling PHP-FPM.

If you’re facing this issue, follow these steps:

Firstly, ensure that PHP-FPM is activated for the domain experiencing the problem. Here’s what you need to do:

  1. Log in to WHM.
  2. Check if your domain is using PHP-FPM by going to MultiPHP Manager.
  3. Confirm whether PHP-FPM is active for the domain on that page.

Once PHP-FPM is installed on your server, you can enable exec() in PHP-FPM by following these steps:

  1. Connect to the server via SSH.
  2. Check the PHP version of the server using this command:
    php -v
  3. Open the PHP-FPM configuration file using the command:
    vi /opt/cpanel/ea-php70/root/etc/php-fpm.d/some.domain.tld.conf
  4. Locate the exec() function in the list of disabled functions:
    php_admin_value[disable_functions] = passthru,shell_exec,system
  5. Remove “exec” from the above line.
  6. Restart PHP-FPM using this command:
    /scripts/restartsrv_apache_php_fpm

Now, the exec() function should work properly. If you need further assistance with web hosting, don’t hesitate to contact host.co.in team.