Applicable to:
- Plesk for Linux
Question
How to customize PHP-FPM pool settings for a domain through Plesk UI?
Answer
-
Go to Plesk > Domains > example.com > PHP Settings;
-
Scroll the page down to the PHP-FPM settings section:
-
Modify the present directives according to the requirements:
-
Directives that are not present in this list can be specified in the Additional configuration directives section:
-
Press the OK button to apply changes.
Note: The following changes will be applied to all non-locked subscriptions assigned to the modified service plan
-
Go to Service Plans > Click on Service Plan name > PHP Settings
-
Select the FPM application served by Apache or FPM application served by nginx as a PHP handler if it is not selected yet:
-
Scroll the page down till the PHP-FPM settings section:
-
Modify the present directives according to the requirements.
-
Directives that are not present in this list can be specified in the Additional configuration directives section:
-
Press the OK button to apply changes.
Comments
18 comments
In /opt/plesk/php/7.0/etc/php-fpm.d/<domain>.conf It says "; Following options can be overridden", however it seems they can't and do get overwritten by Plesk meaning this method is needed.
In this article I think the two images for Plesk and OS provided PHP are the wrong way round.
Hi
> In /opt/plesk/php/7.0/etc/php-fpm.d/<domain>.conf It says "; Following options can be overridden", however it seems they can't and do get overwritten by Plesk meaning this method is needed.
"; Following options can be overridden" - this comment means that directives below can be overwritten in /var/www/vhosts/system/example.com/conf/php.ini config
> In this article I think the two images for Plesk and OS provided PHP are the wrong way round.
Thank you, the article has been updated
If i am using windows plesk onyx how to edit ?
Hello Sathish,
> If i am using windows plesk onyx how to edit ?
This article is not applicable for Plesk on Windows because PHP-FPM handler is only available for Plesk on Linux:
https://docs.plesk.com/en-US/onyx/administrator-guide/web-hosting/php-management/php-handler-types.75145/
The script that creates the php.ini file creates that file, but it does not apply the new settings. It is still necessary to click the "Apply" button in the subscription to reconfigure the php init file of the affected domain for the new default settings to take effect.
Can that be automated, too, e.g. by adding another event that reconfigures PHP for the newly created domain only AFTER the subscription or add-on domain was created? How?
Hi Peter,
Script was updated, thank you for bringing our attention.
Great. Thank you! Just one minor addition please: The "/usr/local/psa/bin/domain" command needs to start in a new line, then everything is perfect.
I am still getting the following error :(
[29-May-2017 16:59:17] WARNING: [pool instahd.info] child 22843 said into stderr: "ERROR: Unable to set php_value 'pm'"
[29-May-2017 16:59:17] WARNING: [pool instahd.info] child 22843 said into stderr: "ERROR: Unable to set php_value 'pm.start_servers'"
[29-May-2017 16:59:17] WARNING: [pool instahd.info] child 22843 said into stderr: "ERROR: Unable to set php_value 'pm.max_children'"
[29-May-2017 16:59:17] WARNING: [pool instahd.info] child 22843 said into stderr: "ERROR: Unable to set php_value 'pm.max_requests'"
[29-May-2017 16:59:17] WARNING: [pool instahd.info] child 22843 said into stderr: "ERROR: Unable to set php_value 'pm.min_spare_servers'"
[29-May-2017 16:59:17] WARNING: [pool instahd.info] child 22843 said into stderr: "ERROR: Unable to set php_value 'pm.max_spare_servers'"
[29-May-2017 16:59:17] WARNING: [pool instahd.info] child 22843 said into stderr: "ERROR: Unable to set php_value 'listen.backlog'"
[29-May-2017 16:59:17] WARNING: [pool instahd.info] server reached max_children setting (5), consider raising it
The above solution not working on CentOS 7.3 anymore.
Latest logs
[29-May-2017 17:22:16] WARNING: [pool instahd.info] child 29821 said into stderr: "ERROR: Unable to set php_value 'pm.max_children'"
[29-May-2017 17:22:16] WARNING: [pool instahd.info] child 29821 said into stderr: "ERROR: Unable to set php_value 'pm.max_requests'"
[29-May-2017 17:22:16] WARNING: [pool instahd.info] child 29824 said into stderr: "ERROR: Unable to set php_value 'pm.max_children'"
[29-May-2017 17:22:16] WARNING: [pool instahd.info] child 29824 said into stderr: "ERROR: Unable to set php_value 'pm.max_requests'"
[29-May-2017 17:22:16] WARNING: [pool instahd.info] server reached max_children setting (5), consider raising it
@Muhammad, please post the content of /var/www/vhosts/system/example.com/conf/php.ini
@Vitaly my settings are following
listen.backlog = 65535
;[php-fpm-pool-settings]
pm = dynamic
pm.max_children = 5000
pm.start_servers = 50
pm.min_spare_servers = 20
pm.max_spare_servers = 70
pm.max_requests = 2000
I have 64GB of Ram
@Muhammad, try to remove semicolon before [php-fpm-pool-settings] section and run the following command:
# /usr/local/psa/bin/php_settings -u
@Vitaly thanks, that works
This article contains incorrect information. It refers to A SINGLE DOMAIN, not all domains! Hence, the suggestion to use this command is plain wrong:
/usr/local/psa/bin/php_settings -u
Its help shows:
/usr/local/psa/bin/php_settings -h
Usage: php_settings command [options]
Available commands:
--update-all or -u Update per-domain PHP settings of all
domains in accordance with the
server-wide php.ini file.
--help or -h Displays this help page.
Version: 17.5.3_build1705170317.16 os_CentOS 7
What else is wrong in here, other than using a command that's not fit for purpose? Guess what: after adjusting the php-fpm settings for ONE DOMAIN ONLY I've blindly ran from cli:
/usr/local/psa/bin/php_settings -u
Guess what: 19 minutes on and it's still running. Hell, what is it doing? Recompiling the linux kernel in a php sandbox?
Please fix the article.
@Adi Pircalabu
Hello!
The command "/usr/local/psa/bin/php_settings -u" updates per-domain PHP settings of all domains that is why it takes noticeable time.
In order to update PHP settings just for a single domain, use the command:
plesk bin subscription --update-php-settings example.com -settings /var/www/vhosts/system/example.com/conf/php.ini
The article will be updated. Thank you for bringing it to our attention!
I am having a critical issue and hope you can give us some help .
One of our domain is refusing to load after couple of minutes being live .
What is interesting we have exactly same kin of website with almost same plugins and never sow the problem here.
After time we see multiple lines of this in htop php-fpm: pool crypto-....io
And site will not load by then , even though rest of the domains still work fine .
Immunify test and every other possible test show everything is fine . Thanks .
@Albert Stepanyan,
I would recommend creating a ticket to Plesk Support Team so they can check this issue in depth.
Check this article for more details.
Hi,
Something is working wrong on: Plesk Obsidian Version 18.0.31 Update #1
I need to add "pm.status" on php-fpm for single domain, but seems the system only can override existing configuration, not add new parameters. I show you:
1. Without any parameter on "Additional configuration directives", we do:
cat /opt/plesk/php/7.4/etc/php-fpm.d/domainxxx.conf | grep "pm\."
listen = php-fpm.sock
pm.max_children = 101
pm.max_spare_servers = 1
pm.min_spare_servers = 1
pm.process_idle_timeout = 10s
pm.start_servers = 1
2. We put on "Additional configuration directives" and do Apply and OK:
[php-fpm-pool-settings]
pm.status = /status
pm.max_children = 101
pm.process_idle_timeout = 666s
3. Now, we can see the next: cat /opt/plesk/php/7.4/etc/php-fpm.d/domainxxx.conf | grep "pm\."
listen = php-fpm.sock
pm.max_children = 101
pm.max_spare_servers = 1
pm.min_spare_servers = 1
pm.process_idle_timeout = 666s
pm.start_servers = 1
Where is the new parameter pm.status ?
Note: I also try from CLI but happens the same.
Thank you!
Please sign in to leave a comment.