Skip to main content
1 of 2

The other answers explains good what it should be, I only want to add a script to fix the permissions if you already uploaded a component and can't access the files with ftp.

In this case I upload this file as fix.php to the ftp server and open it in the browser: http://example.com/fix.php

<?php
file_fix_directory(dirname(__FILE__));

function file_fix_directory($dir, $nomask = array('.', '..')) {
  if (is_dir($dir)) {
     // Try to make each directory world writable.
     if (@chmod($dir, 0777)) {
       echo "<p>Made writable: " . $dir . "</p>";
     }
  }
  if (is_dir($dir) && $handle = opendir($dir)) {
    while (false !== ($file = readdir($handle))) {
      if (!in_array($file, $nomask) && $file[0] != '.') {
        if (is_dir("$dir/$file")) {
          // Recurse into subdirectories
          file_fix_directory("$dir/$file", $nomask);
        }
        else {
          $filename = "$dir/$file";
            // Try to make each file world writable.
            if (@chmod($filename, 0666)) {
              echo "<p>Made writable: " . $filename . "</p>";
            }
        }
      }
    }

    closedir($handle);
  }

}

This script sets all files to 666 and all directories to 777. World write able, thats not the best set of permissions for a shared host but you can access your files again and may set it correctly with ftp.