Question
How can I enable, disable, or adjust PHP-FPM settings for a cPanel account from the command line?
Answer
PHP-FPM is managed per virtual host, so addon domains and subdomains each carry their own setting. Use the php_set_vhost_versions WHM API call.
To enable this for a single user.
# whmapi1 php_set_vhost_versions version='ea-php70' vhost-0='example.tld' php_fpm=1
Warning: PHP-FPM cannot be adjusted on an "inherited" PHP version. You must specify an explicit version, such as ea-php70.
To disable PHP-FPM, for a single user:
# whmapi1 php_set_vhost_versions version='ea-php70' vhost-0='example.tld' php_fpm=0
To enable this for multiple users:
# whmapi1 php_set_vhost_versions version='ea-php70' \
vhost-0='domain.to.change' \
vhost-1='domain.to.change2' \
vhost-2='domain.to.change3' \
php_fpm=1
When enabling PHP-FPM, pool parameters can be supplied at the same time:
# whmapi1 php_set_vhost_versions version='ea-php70' vhost-0='domain.to.change' php_fpm=1 \
php_fpm_pool_parms='{"pm_max_children":5,"pm_max_requests":20,"pm_process_idle_timeout":10}'
Warning: The values above are examples and are not an exhaustive list. See the configuration reference in Additional Resources for all supported parameters.
Additional Resources
WHM API 1 - Update domain's PHP values
Configuration Values of PHP-FPM
WHM API 1 - Return PHP version of all virtual hosts
How to change PHP handlers from the command line
Comments
0 comments
Article is closed for comments.