#!/usr/bin/perl -wusestrict;my$fname=$ARGV[0];if(!$fname){print"\nUsage: find /home/ -name .htaccess -exec /root/htaccess_php_off.pl {} \\; | tee htaccess_php_off.log \n";# also not forget to fix file owners# cd /home; for user in */; do find $user -user www -not -name tmp -exec chown -hvv ${user%/} {} +; doneexit;}open(FILE,"<$fname")||die"File not found";my@lines=<FILE>;close(FILE);my@newlines;my$php=0;my$mod=0;foreach(@lines){if(!$php){if(/^\s*<IfModule\s+(mod_php.|php._module)/){$php++;}else{my$str=$_;s/^(\s*php_)/#$1/&&($strne$_)&&$mod++;}}else{/^\s*<IfModule\s/&&$php++;/^\s*<\/IfModule/&&$php--;}push(@newlines,$_);}$mod||exit;open(FILE,">$fname")||die"Write error";printFILE@newlines;close(FILE);print"$fname converted.\n"
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.