Possibility to use a custom PHP pool per share

This commit is contained in:
Daniel Berteaud 2017-07-14 12:40:34 +02:00
parent d7656b699c
commit 3f76ffa141
2 changed files with 9 additions and 2 deletions

View File

@ -39,10 +39,16 @@ _EOF
next if ($share->prop('DynamicContent' || 'disabled') ne 'enabled');
my $key = $share->key;
my $ver = $share->prop('PHPVersion') || '';
my $socket = "php$ver-$key.sock";
my $custom = $share->prop('PHPCustomPool') || undef;
if ($custom){
$ver = $p->get($custom)->prop('Version') || '';
$socket = "php$ver-$custom.sock";
}
$OUT .=<<_EOF;
Action php$key-fastcgi /php-cgi-bin/php$key-wrapper
Alias /php-cgi-bin/php$key-wrapper /var/www/php-cgi-bin/php$key-wrapper
FastCgiExternalServer /var/www/php-cgi-bin/php$key-wrapper -socket /var/run/php-fpm/php$ver-$key.sock -pass-header Authorization -idle-timeout 120
FastCgiExternalServer /var/www/php-cgi-bin/php$key-wrapper -socket /var/run/php-fpm/$socket -pass-header Authorization -idle-timeout 120
_EOF
# Custom PHP pools

View File

@ -6,7 +6,8 @@ my $a = esmith::AccountsDB->open_ro || die "Couldn't open the accounts database"
foreach my $share ($a->get_all_by_prop(type => 'share')){
my $version = $share->prop('PHPVersion') || '';
my $dynamic = $share->prop('DynamicContent') || 'disabled';
next unless ($dynamic eq 'enabled' && $version eq $PHP_VERSION);
my $custom = $share->prop('PHPCustomPool') || undef;
next unless ($dynamic eq 'enabled' && $version eq $PHP_VERSION && !$custom);
my $key = $share->key;
my $pool_name = 'php' . $version . '-' . $key;
my $memory_limit = $share->prop('PHPMemoryLimit') || '128M';