title: Permission denied when opening or creating files with PHP
body: <p>I can't create files with php, because the file dosent got permission for that.
  I get this error:</p>
  
  <blockquote>
    <p>Warning: fopen(test.txt): failed to open stream: Permission denied in /web/com/example.com/index.php on line 20<br>
    Warning: fwrite() expects parameter 1 to be resource, boolean given in /web/com/example.com/index.php on line 21<br> 
    Warning: fclose() expects parameter 1 to be resource, boolean given in /web/com/example.com/index.php on line 22<br></p>
  </blockquote>
  
  <p>This is the code I was using:</p>
  
  <pre><code>&lt;?php
   $file = fopen("test.txt","w");
   echo fwrite($file,"Hello World. Testing!");
   fclose($file);
   ?&gt; 
  </code></pre>
  
  <p>Simple as that!  This is <a href="http://www.w3schools.com/php/func_filesystem_fwrite.asp" rel="nofollow noreferrer">example code from w3schools</a>.</p>
  
  <p>So I need help to find out how to give the file the needed permissions.
  I'm uploading files to my site with the <a href="http://net2ftp.com/" rel="nofollow noreferrer">net2ftp</a> FTP web application, if it matters.</p>