Enabling PHP-FPM (PHP FastCGI Process Manager) in cPanel/WHM automatically turns off a few features most notable the exec() function.
This function is most notably needed with WordPress plugins that process images or other files on your server. A good example is the popular EWWW Image Optimizer plugin.
Please note that the tutorial below is meant for cPanel/WHM users that plan on using PHP-FPM and wnat to enable exec() for a single domain. If you make these changes and then switch off PHP-FPM and switch it back on again, the configuration file will be automatically run over by WHM’s script.
What happens when you enable exec() in PHP you ask and why is it disabled by default? Well, it’s quite simple, this function allows your PHP script to make shell commands. Speaking security-wise, if you don’t know why you would need this function you probably don’t need it at all.
First, let’s check if we are using PHP-FPM for a specific domain.
1) Login to WHM.
2) Navigate to MultiPHP Manager to check whether the domain is using PHP-FPM or not.
Now you can either login to your server as root via SSH (putty or similar software) or you can just use the Terminal tab in WHM.
4) Check the PHP version of the server using the below command.
5) Then open the PHP-FPM configuration file.
Replace domain.tld with the actual domain.
6) Then you will find the exec() function in the disabled function list.
php_admin_value[disable_functions] = passthru,shell_exec,system
7) Remove that from the above line.
8) Then restart PHP-FPM using the below command.
You can also restart the service from WHM.