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-
- Login to WHM.
- You can check if your domain uses PHP-FPM by navigating to MultiPHP Manager.
- 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-
- Connect via SSH to the server.
- Use the following command to check the PHP version of the server.
- Open the PHP-FPM configuration file.
# vi /opt/cpanel/ea-php70/root/etc/php-fpm.d/blah.domain.tld.conf
- You will find the exec() function in the disabled function list.
php_admin_value[disable_functions] = passthru,shell_exec,system
- Remove “exec” from the upper line.
- Use the following command to restart PHP-FPM.
This way exec() works. For any extra assistance with web hosting, feel free to contact our support team.