Cleanups in shares php pool templates

tags/0.0.1_0.fc26_el5 0.0.1_0.fc26_el5
Daniel Berteaud 8 years ago
parent daef899874
commit d7656b699c
  1. 15
      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"; my $a = esmith::AccountsDB->open_ro || die "Couldn't open the accounts database";
foreach my $share ($a->get_all_by_prop(type => 'share')){ foreach my $share ($a->get_all_by_prop(type => 'share')){
next if (($share->prop('DynamicContent') || 'disabled') ne 'enabled');
my $version = $share->prop('PHPVersion') || ''; 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 $key = $share->key;
my $pool_name = 'php' . $version . '-' . $key; my $pool_name = 'php' . $version . '-' . $key;
my $memory_limit = $share->prop('PHPMemoryLimit') || '128M'; 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 . my $open_basedir = $share->prop('PHPBaseDir') || '/home/e-smith/files/shares/' . $key .
':/var/lib/php/' . $key; ':/var/lib/php/' . $key;
my $disabled_functions = $share->prop('PHPDisabledFunctions') || 'system,show_source,' . my $disabled_functions = $share->prop('PHPDisabledFunctions') || 'system,show_source,' .
'symlink,exec,dl,shell_exec,' . 'symlink,exec,dl,shell_exec,' .
'passthru,phpinfo,' . 'passthru,phpinfo,' .
'escapeshellarg,escapeshellcmd'; 'escapeshellarg,escapeshellcmd';
# Format vars # Format vars
$file_upload = ($file_upload =~ m/^1|yes|on|enabled$/) ? 'on' : 'off'; $file_upload = ($file_upload =~ m/^1|yes|on|enabled$/) ? 'on' : 'off';
$allow_url_fopen = ($allow_url_fopen =~ 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); $disabled_functions = join(', ', split /[,;:]/, $disabled_functions);
$open_basedir = join(':', split(/[,;:]/, $open_basedir));
$OUT .=<<"_EOF" if ($version eq $PHP_VERSION); $OUT .=<<"_EOF" if ($version eq $PHP_VERSION);
@ -40,11 +42,9 @@ pm.max_children = 15
pm.start_servers = 3 pm.start_servers = 3
pm.min_spare_servers = 3 pm.min_spare_servers = 3
pm.max_spare_servers = 4 pm.max_spare_servers = 4
pm.max_requests = 5000 pm.max_requests = 1000
request_terminate_timeout = 30
slowlog = /var/log/php/$key/slow.log slowlog = /var/log/php/$key/slow.log
php_admin_value[session.save_path] = /var/lib/php/$key/session 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[opcache.file_cache] = /var/lib/php/$key/opcache
php_admin_value[upload_tmp_dir] = /var/lib/php/$key/tmp php_admin_value[upload_tmp_dir] = /var/lib/php/$key/tmp
php_admin_value[error_log] = /var/log/php/$key/error.log 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[session.cookie_httponly] = on
php_admin_flag[allow_url_include] = off php_admin_flag[allow_url_include] = off
php_admin_value[session.save_handler] = files php_admin_value[session.save_handler] = files
php_admin_value[open_basedir] = $open_basedir
_EOF _EOF
} }

Loading…
Cancel
Save