cPanel

Enabling PHP-FPM forces disable_functions in cPanel

PHP-FPM forces disable_functions
PHP-FPM

Enabling PHP-FPM forces disable_functions in cPanel

As you know, the new cPanel versions with EasyApache 4 has an option to enable PHP-FPM account wise. But enabling PHP-FPM forces disable_functions in cPanel. If we enable PHP-FPM on a particular cPanel account, it overrides the “disable_functions” setting of the loaded PHP configuration.

You can enable PHP functions in another way on PHP-FPM enabled accounts using the following steps:

1. Create the /var/cpanel/ApachePHPFPM directory:
mkdir /var/cpanel/ApachePHPFPM
2. Create the /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml file:
touch /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml
3. Edit /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml using your preferred text editor (e.g. vi, nano). I am using VIM editor here. It needs to look exactly like this:
php_admin_value_disable_functions: { name: 'php_admin_value[disable_functions]', value: passthru,system }

In this example, “passthru,system” are left as disabled functions. You can add more functions to the “value” section to enable the disabled function.

4. Then Regenerate the PHP-FPM configuration files:
/scripts/php_fpm_config --rebuild
5. Restart the Apache PHP-FPM and Apache service:
/scripts/restartsrv_apache_php_fpm
/scripts/restartsrv_httpd

It disables additional functions on top of what’s you have already in the global php.ini file once you add a custom disable_fuctions value in the PHP-FPM configuration as per the above example. For example, you have following disable functions on your global php.ini file:

disable_functions = popen,proc_open

And you have the disable_fuctions “passthru,system” on your custom PHP-FPM configuration; then the actual disabled functions would include passthru, system, popen, proc_open. Also, please note that the disable_fuctions in the PHPINFO output of the website will only show what you have configured in the custom PHP-FPM file. Additionally, please keep in mind that you can’t enable PHP functions on the custom PHP-FPM that are already disabled in the global php.ini configuration file.

That it!

Also Read:

If you like this post and wish to receive more articles from us, please like our FB page: GrepItOut

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.

For more details on our services, please drop us an E-mail at info@grepitout.com

Add Comment

Click here to post a comment

Topics