title: Permission denied mkdir for cron and browser
body: <p>We have an PHP XML parsing script that uploads photos to a folder structure like <code>/content/images/2012/05/31/%object_id%/</code>. This parser runs primarily as a DirectAdmin cronjob. We run into many problems getting the folder permissions right to enable the uploading in that directory for both the cronjob as running the parser via the browser.</p>
  
  <p>According to <code>print_r(posix_getpwuid(fileowner($directory)));</code> the owner of the directory is  is the same as <code>get_current_user()</code>. Nevertheless I receive: <code>Warning: mkdir() [function.mkdir]: Permission denied</code> when running the script via the browser. It works fine when running it as a cron job.</p>
  
  <p>All folders have chmod 0777 and new folders are created as such;</p>
  
  <pre><code>mkdir($path,0777,true);
  </code></pre>
  
  <p>Naturally we have the same permission problems with uploading and/or deleting the files themselves.</p>
  
  <p>Is there any way to enable all the file actions running both as a cron job and through the browser?</p>
  
  <p>We are running Linux with PHP Version 5.2.17.</p>