From 3f76ffa14155d9e13502de7a63dfa88a8ac802b2 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 14 Jul 2017 12:40:34 +0200 Subject: [PATCH] Possibility to use a custom PHP pool per share --- .../e-smith/templates/etc/httpd/conf/httpd.conf/68FastCGIConfig | 8 +++++++- root/etc/e-smith/templates/etc/php-fpm.d/shares.conf/10Shares | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/68FastCGIConfig b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/68FastCGIConfig index eb4bc3f..2ff82c3 100644 --- a/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/68FastCGIConfig +++ b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/68FastCGIConfig @@ -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 diff --git a/root/etc/e-smith/templates/etc/php-fpm.d/shares.conf/10Shares b/root/etc/e-smith/templates/etc/php-fpm.d/shares.conf/10Shares index 8057863..fb675f6 100644 --- a/root/etc/e-smith/templates/etc/php-fpm.d/shares.conf/10Shares +++ b/root/etc/e-smith/templates/etc/php-fpm.d/shares.conf/10Shares @@ -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';