From d7656b699c09a696166ee83d197bdfbd9cb4ee0a Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 14 Jul 2017 12:29:46 +0200 Subject: [PATCH] Cleanups in shares php pool templates --- .../e-smith/templates/etc/php-fpm.d/shares.conf/10Shares | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) 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 9c19d07..8057863 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 @@ -4,8 +4,9 @@ use esmith::AccountsDB; my $a = esmith::AccountsDB->open_ro || die "Couldn't open the accounts database"; foreach my $share ($a->get_all_by_prop(type => 'share')){ - next if (($share->prop('DynamicContent') || 'disabled') ne 'enabled'); my $version = $share->prop('PHPVersion') || ''; + my $dynamic = $share->prop('DynamicContent') || 'disabled'; + next unless ($dynamic eq 'enabled' && $version eq $PHP_VERSION); my $key = $share->key; my $pool_name = 'php' . $version . '-' . $key; my $memory_limit = $share->prop('PHPMemoryLimit') || '128M'; @@ -18,13 +19,14 @@ foreach my $share ($a->get_all_by_prop(type => 'share')){ my $open_basedir = $share->prop('PHPBaseDir') || '/home/e-smith/files/shares/' . $key . ':/var/lib/php/' . $key; my $disabled_functions = $share->prop('PHPDisabledFunctions') || 'system,show_source,' . - 'symlink,exec,dl,shell_exec,' . - 'passthru,phpinfo,' . - 'escapeshellarg,escapeshellcmd'; + 'symlink,exec,dl,shell_exec,' . + 'passthru,phpinfo,' . + 'escapeshellarg,escapeshellcmd'; # Format vars $file_upload = ($file_upload =~ m/^1|yes|on|enabled$/) ? 'on' : 'off'; $allow_url_fopen = ($allow_url_fopen =~ m/^1|yes|on|enabled$/) ? 'on' : 'off'; $disabled_functions = join(', ', split /[,;:]/, $disabled_functions); + $open_basedir = join(':', split(/[,;:]/, $open_basedir)); $OUT .=<<"_EOF" if ($version eq $PHP_VERSION); @@ -40,11 +42,9 @@ pm.max_children = 15 pm.start_servers = 3 pm.min_spare_servers = 3 pm.max_spare_servers = 4 -pm.max_requests = 5000 -request_terminate_timeout = 30 +pm.max_requests = 1000 slowlog = /var/log/php/$key/slow.log php_admin_value[session.save_path] = /var/lib/php/$key/session -php_admin_value[soap.wsdl_cache_dir] = /var/lib/php/$key/wsdlcache php_admin_value[opcache.file_cache] = /var/lib/php/$key/opcache php_admin_value[upload_tmp_dir] = /var/lib/php/$key/tmp php_admin_value[error_log] = /var/log/php/$key/error.log @@ -63,6 +63,7 @@ php_admin_flag[file_upload] = $file_upload php_admin_flag[session.cookie_httponly] = on php_admin_flag[allow_url_include] = off php_admin_value[session.save_handler] = files +php_admin_value[open_basedir] = $open_basedir _EOF }