In this article, we will explain how to allow exec in PHP-FPM. Occasionally, the exec() function does not work after turning on PHP-FPM, and we cannot find any disabled functions in the PHP configuration file. We can exec again after turning off PHP-FPM.
Please follow these steps if you are experiencing this issue:
- To begin, make sure PHP-FPM is enabled on the domain that is experiencing the issue. Follow the steps below:
a) Login to WHM.
b) You can check if your domain uses PHP-FPM by navigating to MultiPHP Manager.
c) You can verify whether PHP-FPM is being used by the domain on that page. - Your server now has PHP-FPM installed. To enable exec() in PHP-FPM, follow the steps below:
1) Connect via SSH to the server.
2) Use the following command to check the PHP version of the server.
#php -v
3) Open the PHP-FPM configuration file.
# vi /opt/cpanel/ea-php70/root/etc/php-fpm.d/blah.domain.tld.conf
4) You will find the exec() function in the disabled function list.
php_admin_value[disable_functions] = passthru,shell_exec,system
5) Remove “exec” from the upper line.
6) Use the following command to restart PHP-FPM.
# /scripts/restartsrv_apache_php_fpm
This way exec() works. For any extra assistance with web hosting, feel free to contact our support team.