How to Enable exec() in PHP-FPM? Print

  • 425

Learn how to enable exec() function on cPanel Server below are steps.

If exec() function is not working after turning on the PHP-FPM and in php configuration file we could not find any disable functions. If we turned off the PHP-FPM the exec function is working again. 

If you are facing such issues, please follow the below steps.

First, you need to verify the PHP-FPM is enabled on the domain that facing the issue. Please follow the steps.

1) Login to WHM.
2) Navigate to MultiPHP Manager to check whether the domain is using PHP-FPM or not.
3) From that page, you can verify that the domain is using PHP-FPM.

Now you have verified that PHP-FPM is on the server. So you need to follow the steps to enable exec() in PHP-FPM.

1) Login to server via SSH.
2) Check the PHP version of the server using the below command.

# php -v

3) Then open the PHP-FPM configuration file.

# vi /opt/cpanel/ea-php70/root/etc/php-fpm.d/example.com.conf

4) Then you will find the exec() function in the disabled function list.

php_admin_value[disable_functions] = passthru,shell_exec,system

5) Remove that from the above line.
6) Then restart PHP-FPM using the below command.

# /scripts/restartsrv_apache_php_fpm

Now exec() should works.

 


Was this answer helpful?

« Back

Powered by WHMCompleteSolution