title: Apache file ownership / group
body: <p>I currently manage 8 different sites for my organisation and built a central management website to help manage the content on them all. </p>
  
  <p>I currently have a file uploader on the administration website that allows me to upload ZIP files to the server. This script then unzips the package, and moves the files to different parts of the server. </p>
  
  <p>The problem is, when I upload files through the browser, it assigns ownership to apache (for both user and group). This causes me a problem when I try to overwrite the files using FTP.</p>
  
  <p>I have tried to change the owner of the uploaded files as soon as they've been uploaded / moved, both with PHPs native 'chown' function and also using the exec function to run the linux command chown but both fail (PHPs native chown displays an 'operation not permitted' error)</p>
  
  <p>So my questions: 
  1) Am I going about this the wrong way? (My knowledge of file ownership is limited)
  2) Is there a reason why I shouldn't change file ownership?
  3) Are there any work arounds?</p>
  
  <p>If you would like any more information, please feel free to ask.</p>
  
  <p>Many thanks</p>
  
  <p>Phil</p>
  
  <p>Current file details of file uploaded via browser:</p>
  
  <pre><code>[file].php      permissions: adfr (0644)    Owner: Apache    Group: Apache
  </code></pre>
  
  <p>File details of file uploaded via FTP:</p>
  
  <pre><code>[file].php      permissions: adfr (0644)    Owner: [ftp login name]   Group: psacln
  </code></pre>