title: How can I change the user owner so a folder created with a PHP script can be edited and/or deleted through FTP?
body: <p>We have a little CMS where we create folders for specific content.
  Everything was working fine until we moved to a new server; I noticed that on the new server the "user" from PHP (CMS action) is different from the FTP user. This was not happening before, but now every time a new folder is created through the PHP script it can not be modified through FTP.</p>
  
  <p>I noticed that the owner of the PHP folders is 99 99 which I thing is 'nobody'.</p>
  
  <p>What do I need to do in order for it to work as it was working in the previous server?
  On my PHP scripts the permissions are set to 0777 so I really don't know what else to do.</p>
  
  <p>I have access to SSH, WHM and cpanel, maybe there is something inside the PHP settings or APACHE settings that I can modify, maybe straight through WHM.</p>
  
  <p>Please, if there is something to work on the command shell describe it step by step as I mostly know nothing about shell scripting.</p>
  
  <p>This is the code I use in PHP to create my folders:</p>
  
  <pre><code>$year_folder = date(Y)."/";
  $user_folder = $year_folder."$alias/";
  $section_folder = $user_folder."$section/";
  
  //CREATE YEAR FOLDER and persmissions (Forbiden to access directly)
  if (!file_exists($year_folder)) {
      mkdir("$year_folder", 0711);// create directory
  }
  
  //CREATE USER FOLDER
  if (!file_exists($user_folder)) {
      mkdir("$user_folder", 0777);// create directory
  }           
  
      //CREATE CLASS FOLDER
  if (!file_exists($section_folder)) {
      mkdir("$section_folder", 0777);
  }
  </code></pre>
  
  <p>Thanks!</p>