title: creating folders and permissions in linux
body: <p>I wanted to create a folder and set its permission.
  It was working fine with windows, but when I shifted to linux,
  it had permission problems.</p>
  
  <pre><code>//Make new directory    
  $directory = dirname($this-&gt;fileName);
  if(!is_dir($directory)) {
    if (!mkdir($directory, 0777, true))
      die('Failed to create folders...');
  } else {
    die('ah ok...');
  }
  </code></pre>
  
  <p>For this to work, I have to set the folder permission manually to <code>777</code>.
  Then after that the application can run successfully.</p>
  
  <p>Then I delete the existing folder again to test it, cannot create again because
  permission denied, it fails to create folder.</p>