title: PHP create folder with specific path and permissions
body: <p>I need a way in PHP to create some folder if they do not exist.</p>
  
  <p>So the code will have to first read the available folders, if the specific folder does not exist then it should create it.</p>
  
  <p>The logic of the code would be:</p>
  
  <pre><code>$folderName = "user1";
  
  If($folderName exists) {
  exit;
  }else{
  create folder $folderName and chmod 777
  }
  </code></pre>
  
  <p>How would I do it with PHP and Linux server + Apache?</p>