title: PHP: write a remote file to a directory, without chmod 777
body: <p>On my (shared) webhost, I'm using PHP's curl and fopen to download and save a remote XML-file to a specific directory. The system has to read and execute it later.
  Right now, I've created the directory beforehand (permissions: 777) and the system is able to write the XML-file in the directory.</p>
  
  <p>I am afraid that giving permissions to anyone to read, write and execute is a security risk. 
  Therefore, my questions are: </p>
  
  <ol>
  <li>Is setting chmod to 777 a security risk in this case?  </li>
  <li>Is there a way to achieve the desired results without setting chmod to 777?</li>
  </ol>
  
  <p><em>(Since I am a beginner, I'm not (yet) familiar with file users, file groups and file permissions. Is there a way that only "the system" is able to read, execute and write?)</em></p>