How to enable exec() function in PHP-FPM

How to enable exec() function in PHP-FPM

Date: 02-10-2021

Step 1: Log in to the server via SSH.

Step 2: Check the PHP version of the server by using the below command.
# php -v

Step 3: If your domain using PHP version 7.3, open the PHP-FPM configuration file.
# vi /opt/cpanel/ea-php73/root/etc/php-fpm.d/domainname.conf
Note: – domainname.conf – Your domain name config file.

Search the disabled function list in the config file and find the exec function.

php_admin_value[disable_functions] = exec,passthru,shell_exec,system

Step 4: Remove that exec function from the above line and keep like below.
php_admin_value[disable_functions] = passthru,shell_exec,system

Step 5: Restart the PHP-FPM service by using the below command and then exec function should works.
# /scripts/restartsrv_apache_php_fpm

Thank you!


admin

Our team has expertise across software and web development, WordPress, e-commerce, mobile applications, UI/UX, cloud and infrastructure, DevOps, CI/CD, API integration, security, testing, automation, and technical support. The team also works with AI-based software solutions, LLMs, AI workflows, AI agents, and intelligent application development to help businesses automate processes and build smarter digital solutions. We focus on developing, deploying, maintaining, and optimising secure, scalable, and reliable technology solutions while helping businesses adopt modern technologies and drive digital transformation.

Leave a Reply

Scroll to Top