title: PHP Dynamically Create Apps
body: <p>I'm working on a CRM, based on DigitalOcean and User Registration.</p>
  
  <p>I want to make it so that when user runs installer.php, a new CRM app will be created.</p>
  
  <p>(Signup > Create app folder > Create app database) </p>
  
  <p>I'm having trouble generating this App folders, as they must all have unique id's.</p>
  
  <p>Let's say mycrm.com/crm-1/ has it's database crm-1, and so on ..</p>
  
  <p>How can I programmatically create an app folder and database autoincrementing the id's for each registered user?</p>
  
  <p>I thought of getting the last signed up user id and adding 1, but if 2 users sign up (and create app and database) at the same time, things would get messed up. </p>
  
  <p>Is there a way to do this that I am not aware of?</p>