title: Creating and modifying files inside a php library under .htpasswd protected folder (from the library itself)
body: <p>I've got a PHP library inside a folder that is protected through .htpasswd.</p>
  
  <p>To be able to change the library configuration, I've created a html/php console inside that folder too.</p>
  
  <p>After properly logging in to the console through valid user/password, the console can call some php scripts (inside the library itself) that aim to create/modify some files to be able to change some of the library parameters dynamically.</p>
  
  <p>Anyways, when trying to modify/create files or running chmod, i get "Operation not permitted" and "Permission denied" messages.</p>
  
  <p>This is fixed if I modify a subfolder permissions to 777 (just in the one i want to modify the files), but i'm wondering if this represents a security hole.</p>
  
  <p>Which is the best practice to allow the library modify some of its files without losing any security in its folder from the outside?</p>