@@ -1547,10 +1547,7 @@ sub feature_get_web_php_children
15471547{
15481548my ($d ) = @_ ;
15491549my $mode = &feature_get_web_php_mode($d );
1550- my $childrenmax =
1551- defined (&virtual_server::get_php_max_childred_allowed) ?
1552- &virtual_server::get_php_max_childred_allowed() :
1553- $virtual_server::max_php_fcgid_children ;
1550+ my $childrenmax = &virtual_server::get_php_max_children_allowed();
15541551if ($mode eq " fcgid" ) {
15551552 # Stored in the domain's config
15561553 return $d -> {' nginx_php_children' } || 0;
@@ -1574,10 +1571,7 @@ sub feature_get_web_php_children
15741571sub feature_save_web_php_children
15751572{
15761573my ($d , $children ) = @_ ;
1577- my $childrenmax =
1578- defined (&virtual_server::get_php_max_childred_allowed) ?
1579- &virtual_server::get_php_max_childred_allowed() :
1580- $virtual_server::max_php_fcgid_children ;
1574+ my $childrenmax = &virtual_server::get_php_max_children_allowed();
15811575$d -> {' nginx_php_children' } ||= 0;
15821576if ($children != $d -> {' nginx_php_children' }) {
15831577 my $children_curr = $d -> {' nginx_php_children' } ||
@@ -1593,21 +1587,23 @@ sub feature_save_web_php_children
15931587 # Set in the FPM config
15941588 my $conf = &virtual_server::get_php_fpm_config($d );
15951589 return 0 if (!$conf );
1596- $children = $childrenmax if ($children == 0); # Recommended default
1597- my $fpmstartservers =
1598- defined (&virtual_server::get_php_start_servers) ?
1599- &virtual_server::get_php_start_servers($children ) : 1;
1590+ $children = $childrenmax if ($children == 0); # Use recommended default
1591+
16001592 &virtual_server::save_php_fpm_pool_config_value(
16011593 $conf , $d -> {' id' }, " pm.max_children" , $children );
1602- &virtual_server::save_php_fpm_pool_config_value(
1603- $conf , $d -> {' id' }, " pm.start_servers" , $fpmstartservers );
1594+
16041595 if ($children != $children_curr ) {
1605- my $fpmmaxspare =
1606- defined (&virtual_server::get_php_max_spare_servers)
1607- ? &virtual_server::get_php_max_spare_servers($children )
1608- : int ($children / 2) || $children ;
16091596 &virtual_server::save_php_fpm_pool_config_value(
1610- $conf , $d -> {' id' }, " pm.max_spare_servers" , $fpmmaxspare );
1597+ $conf , $d -> {' id' }, " pm.start_servers" ,
1598+ &virtual_server::get_php_start_servers($children ));
1599+
1600+ &virtual_server::save_php_fpm_pool_config_value(
1601+ $conf , $d -> {' id' }, " pm.min_spare_servers" ,
1602+ &virtual_server::get_php_min_spare_servers($children ));
1603+
1604+ &virtual_server::save_php_fpm_pool_config_value(
1605+ $conf , $d -> {' id' }, " pm.max_spare_servers" ,
1606+ &virtual_server::get_php_max_spare_servers($children ));
16111607 }
16121608 }
16131609 &virtual_server::lock_domain($d );
0 commit comments