73 lines
2.9 KiB
Plaintext

{
if ($PHP_VERSION eq '74'){
if (($phppgadmin{'status'} || 'disabled') eq 'enabled'){
my $max_upload_size = ($phppgadmin{MaxUploadSize} || '100M');# 104857600 bytes
$max_upload_size .= 'M' if ($max_upload_size =~ m/^\d+$/);
my $memory_limit = ($phppgadmin{MemoryLimit} || '512M');
$memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/);
my $open_basedir= $phppgadmin{PHPBaseDir} || '';
$open_basedir = "/usr/share/phpPgAdmin/:/etc/phpPgAdmin/:".
"/usr/share/php/:".
"/var/log/php/phppgadmin:/dev/urandom:/proc/meminfo:$open_basedir";
my $max_children = $phppgadmin{'PHPmaxChildren'} || 20;
my $min_spare_servers = $phppgadmin{'PHPminServers'} || 4;
my $start_servers = $phppgadmin{'PHPstartServers'} || 6;
my $max_spare_servers = $phppgadmin{'PHPmaxServers'} || 8;
my $max_requests = $phppgadmin{'PHPmaxRequests'} || 1000;
$min_spare_servers = ( $min_spare_servers > $max_spare_servers ) ? printf("%.0f",$max_spare_servers/2) : $min_spare_servers;
$start_servers = ( $start_servers > $max_spare_servers ) ? printf("%.0f", $max_spare_servers /2 + $min_spare_servers/2 ) : $start_servers;
my $id = 'phppgadmin';
$OUT .=<<"_EOF";
[php$PHP_VERSION-$id]
user = www
group = www
listen.owner = root
listen.group = www
listen.mode = 0660
listen = /var/run/php-fpm/php$PHP_VERSION-$id.sock
pm = dynamic
pm.max_children = $max_children
pm.start_servers = $start_servers
pm.min_spare_servers = $min_spare_servers
pm.max_spare_servers = $max_spare_servers
pm.max_requests = $max_requests
; Used in nextcloud
php_admin_value[session.save_path] = /var/lib/php/$id/session
php_admin_value[session.gc_maxlifetime] = 86400
php_admin_value[opcache.file_cache] = /var/lib/php/$id/opcache
php_admin_value[upload_tmp_dir] = /var/lib/php/$id/tmp
php_admin_value[sys_temp_dir] = /var/lib/php/$id/tmp
php_admin_value[error_log] = /var/log/php/$id/error.log
slowlog = /var/log/php/$id/slow.log
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f php@{ $DomainName }
php_admin_flag[display_errors] = off
php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = $memory_limit
php_admin_value[max_execution_time] = 3600
php_admin_value[post_max_size] = $max_upload_size
php_admin_value[upload_max_filesize] = $max_upload_size
php_admin_value[disable_functions] = system, show_source, symlink, exec, dl, shell_exec, passthru, phpinfo, escapeshellarg, escapeshellcmd
php_admin_value[open_basedir] = $open_basedir
php_admin_flag[allow_url_fopen] = on
php_admin_flag[file_upload] = on
php_admin_flag[session.cookie_httponly] = on
php_admin_flag[allow_url_include] = off
php_admin_value[session.save_handler] = files
php_admin_flag[output_buffering] = off
php_admin_value[auto_prepend_file] = /usr/share/php/auth_translation.php
php_flag[session.use_trans_sid] = off
php_flag[track_vars] = on
php_flag[magic_quotes_gpc] = off
_EOF
}
else{
$OUT .= '; phppgadmin is disabled';
}
}
}