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:
- Log in to WHM.
- Check if your domain is using PHP-FPM by going to MultiPHP Manager.
- 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:
- Connect to the server via SSH.
- Check the PHP version of the server using this command:
php -v
- Open the PHP-FPM configuration file using the command:
vi /opt/cpanel/ea-php70/root/etc/php-fpm.d/some.domain.tld.conf
- Locate the exec() function in the list of disabled functions:
php_admin_value[disable_functions] = passthru,shell_exec,system
- Remove “exec” from the above line.
- 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.