Files
linuxsetup/setup.phpini
T
2026-08-10 16:12:09 +02:00

61 lines
1.3 KiB
Perl
Executable File

#!/usr/bin/perl
for $v ('7.2','7.3','7.4','8.1') {
if (-f "/etc/php/$v/apache2/php.ini") {
$FILE = "/etc/php/$v/apache2/php.ini";
$OFILE = "/etc/php/$v/apache2/php.ini.org";
}
}
die "$FILE not found" if (!-f $FILE);
die "$FILE skipped" if (-f $OFILE);
$epre = "\"<br><span style='color:#F00;font-family:monospace;font-size:15px;'>\"";
$epost = "\"</span><br>\"";
$P{'html_errors'} = 'On';
$P{'display_errors'} = 'On';
$P{'error_prepend_string'} = $epre;
$P{'error_append_string'} = $epost;
$P{'error_reporting'} = 'E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED';
$P{'short_open_tag'} = 'On';
$P{'upload_tmp_dir'} = '/db/upload';
$P{'upload_max_filesize'} = '10000M';
$P{'post_max_size'} = '10000M';
$P{'max_execution_time'} = '300';
$P{'max_input_time'} = '600';
$P{'memory_limit'} = '512M';
if (!-f $OFILE) {
system("cp $FILE $OFILE");
}
open(IN,$OFILE);
open(OUT,"> $FILE");
while(<IN>) {
if (!/^;/ && !/^\s*$/) {
print OUT "\n" if (/^\[/);
$match=0;
for $key (keys(%P)) {
$match++ if (/^$key/);
}
if ($match>0) {
print OUT ";$_";
} else {
print OUT "$_";
}
}
if (/^\[PHP\]/) {
for $key (sort(keys(%P))) {
print OUT "$key = $P{$key}\n";
}
print OUT "\n";
}
}
close(IN);
close(OUT);