Web Hosting Talk







View Full Version : Automatic CHMOD after installing PHPsuexec?


VolkNet
04-25-2005, 11:54 AM
Is there any script out there that will browse files in your public_html directory and chmod all 777's to like 644 or something in the such?!

That would be super sweet.

Thanks.

Insert_Name_Here
04-25-2005, 12:22 PM
$dir = opendir($mydir);
while((false!==($file=readdir($dir))))
{
if($file!="." and $file !="..")
{
if(substr(sprintf('%o', fileperms($mydir.'/'.$file)), -4) == "0777")
{
chmod($mydir.'/'.$file, 0644);
}
}
}
closedir($dir);

use at own risk....

things might not work after you auto change file permissions

(also has not been tested, but should work)

Burhan
04-25-2005, 04:03 PM
I'm not 100% sure, but I think a umask could work here.