Some applications need PHP’s exec() function to run an external program. On a cPanel server using PHP-FPM, an administrator can remove this function from a domain’s disabled-functions list while retaining the other restrictions.
exec() allows PHP code to start external programs as the account user. Enable it only for an application that needs it, and limit the change to the intended domain.
Check the domain configuration
- In WHM, open Software > MultiPHP Manager.
- Find the domain and confirm its PHP version and that it already uses PHP-FPM.
- Review its effective disable_functions setting. The PHP version shown by php -v over SSH may differ from the version serving the website.
If exec() is not disabled, investigate the application’s error and permissions instead of changing this setting.
Set a persistent domain override
With administrative SSH access, back up the existing file /var/cpanel/userdata/username/example.com.php-fpm.yaml. Replace username and example.com with the actual account and domain.
Edit that YAML file, retaining its existing settings. Add or modify this entry to contain the current disabled-functions list with only exec removed. For example, if the existing list is exec,passthru,shell_exec,system:
php_admin_value_disable_functions: { name: 'php_admin_value[disable_functions]', value: 'passthru,shell_exec,system' }Do not copy this example over a different list. Do not edit the generated file under /opt/cpanel/ea-php/root/etc/php-fpm.d/*, because cPanel rebuilds it.
Rebuild and verify
Arrange a maintenance window because rebuilding and restarting these services can affect other websites. Run cPanel’s supported scripts:
/usr/local/cpanel/scripts/php_fpm_config --rebuild
/usr/local/cpanel/scripts/restartsrv_apache_php_fpm
/usr/local/cpanel/scripts/restartsrv_httpdStop if rebuilding reports an error. Test the application’s required operation through the website. If it fails, check the effective web PHP settings and application logs. Restore the backed-up YAML and rebuild if you need to undo the change.