How to customize PHP-FPM pool settings for a domain through Plesk?

Follow

Comments

17 comments

  • Avatar
    Oliver Burkill

    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.

    0
    Comment actions Permalink
  • Avatar
    Nikolay Zhmuk

    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

    0
    Comment actions Permalink
  • Avatar
    Sathish

    If i am using windows plesk onyx how to edit ?

    0
    Comment actions Permalink
  • Avatar
    Artyom Baranov

    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/

    0
    Comment actions Permalink
  • Avatar
    Peter Debik

    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?

    0
    Comment actions Permalink
  • Avatar
    Konstantin Annikov

    Hi Peter,

    Script was updated, thank you for bringing our attention. 

    0
    Comment actions Permalink
  • Avatar
    Peter Debik

    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.

    0
    Comment actions Permalink
  • Avatar
    Muhammad Hassaan

    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.

    0
    Comment actions Permalink
  • Avatar
    Muhammad Hassaan

    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

     

     

    0
    Comment actions Permalink
  • Avatar
    Vitaly Zhidkov

    @Muhammad, please post the content of /var/www/vhosts/system/example.com/conf/php.ini

    0
    Comment actions Permalink
  • Avatar
    Muhammad Hassaan

    @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

    0
    Comment actions Permalink
  • Avatar
    Vitaly Zhidkov

    @Muhammad, try to remove semicolon before [php-fpm-pool-settings] section and run the following command:

    # /usr/local/psa/bin/php_settings -u

    1
    Comment actions Permalink
  • Avatar
    Muhammad Hassaan

    @Vitaly thanks, that works

    0
    Comment actions Permalink
  • Avatar
    burnleyvic

    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.

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    @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!

    0
    Comment actions Permalink
  • Avatar
    Albert Stepanyan

    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 .

    0
    Comment actions Permalink
  • Avatar
    Anzhelika Khapaknysh

    @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.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request