How to change PHP-FPM pool settings for domain through Plesk UI?

Refers to:

  • Plesk 12.5 for Linux
  • Plesk Onyx for Linux
  • Plesk 12.0 for Linux

Created:

2016-11-16 13:16:35 UTC

Modified:

2017-02-19 09:41:47 UTC

4

Was this article helpful?


Have more questions?

Submit a request

How to change PHP-FPM pool settings for domain through Plesk UI?

Question

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

Answer

Currently there is no way to manage these settings through Plesk UI. This functionality is expected to be implemented in next Plesk major release - Plesk Onyx.

It is possible to change PHP-FPM pool settings for a domain through CLI:

  1. Create file /var/www/vhosts/system/example.com/conf/php.ini and define FPM parameters in it. If the file /var/www/vhosts/system/example.com/conf/php.ini doesn't exist, system administrator is to manually create it. Directives should be specified in [php-fpm-pool-settings] section:

    # cat /var/www/vhosts/system/example.com/conf/php.ini

    [php-fpm-pool-settings]
    pm.max_children = 1000
    pm.max_requests = 1000
  2. Apply new parameters to domain's configuration file:

2.1. Go to Domains > example.com > PHP Settings and click Apply without changing any settings

or

2.2. Run the following command to update PHP parameters:

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

After that the required changes will overwrite pool settings. They will be written in /opt/plesk/php/<version>/etc/php-fpm.d/example.com.conf if PHP support for a domain is provided by Plesk in Domains > example.com > PHP Settings :

alttext

or in /etc/php-fpm.d/example.com.conf if PHP support for a domain is 'provided by OS vendor' in Domains > example.com > PHP Settings :

alttext

If it is required to predefine PHP-FPM pool settings for all newly created domains follow the steps here:

  1. Create script with desired configuration parameters, for example:

    # cat /root/event_handler.sh
    #!/bin/bash
    touch /var/www/vhosts/system/${NEW_DOMAIN_NAME}/conf/php.ini
    echo -e "[php-fpm-pool-settings]\npm = dynamic\npm.start_servers = 3\npm.min_spare_servers = 3\npm.max_spare_servers = 8\npm.max_children = 35\n" > /var/www/vhosts/system/${NEW_DOMAIN_NAME}/conf/php.ini
  2. Create custom event handler in Plesk > Tools & Settings > Event Manager > Add Event Handler for event Physical hosting created which will call script from /root/event_handler.sh .

Have more questions? Submit a request

4 Comments

  • 0
    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
    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
    Avatar
    Sathish

    If i am using windows plesk onyx how to edit ?

  • 0
    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/

Please sign in to leave a comment.