title: failed to open stream: Permission denied in /opt/lampp/htdocs
body: <p>I am using Ubuntu 16.04 &amp; xampp 5.6.30.  I am trying to create a simple login program using file with validation but I am facing problem while putting my data into a file named "login.txt".</p>
  
  <p><strong>Error:</strong> </p>
  
  <pre><code>file_put_contents(login.txt): failed to open stream: Permission denied in /opt/lampp/htdocs/PHP/Practice/PHP Functions/Login Validation/login.php on line 38
  </code></pre>
  
  <p><strong>My code:</strong> </p>
  
  <pre><code>$input = $userName.'|'.$userPassword.'\n';
  
  $myfile = file_put_contents('login.txt', $input.PHP_EOL , FILE_APPEND | LOCK_EX);
  </code></pre>