title: Changing owner and group of newly created directories using PHP script
body: <p>Dedicated Linux server running debain LAMP.</p>
  
  <p>I run a PHP script (using a browser) which creates a directory (and various sub directories) in a folder on the same server for subsequent shared use using Dropbox.<br>
  The directories are created in <code>/home/dropbox/New_Project_Name/new_folders</code> and should be owned by the user 'dropbox'.</p>
  
  <p>However running the php script causes the newly created directories generated by the script to be owned by <code>'www-data'</code></p>
  
  <p>What is the best why of either running the php script from the browser so that it generates the new directories with ownership of user and group 'dropbox' or subsequently running a script to check for www-data ownership and recursively changing files and directories to 'dropbox'</p>
  
  <p>Many thanks for any help.</p>