#!/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 = "\"
\""; $epost = "\"
\""; $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() { 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);