I've found myself having to fix many files and dirs to the correct 644/755 permissions here, and it can get boring and time consuming after just a moment. So I ended up writting a script that'll do just that from the dir it's placed in, down to every subdir. It's written in PHP and am posting it here for anyone that may find it useful.
PHP Code:
<?php
chmod__recursive(dirname($_SERVER['SCRIPT_FILENAME']) . '/');
function chmod__recursive($dir)
{
$dirh = opendir($dir);
while(($file = readdir($dirh)) !== false)
{
if ($file == '.' || $file == '..')
continue;
if (is_dir($dir . $file))
{
chmod($dir . $file, 0755);
chmod__recursive($dir . $file . '/');
continue;
}
if (is_file($dir . $file))
chmod($dir . $file, 0644);
}
closedir($dirh);
}
?>
Comment