title: php 5.3 fwrite() expects parameter 1 to be resource error
body: <p>I am using wamp server. I try to write into the file but it is giving such error: "Warning: fwrite() expects parameter 1 to be resource, boolean given ". How can I solve it?</p>
  
  <pre><code>$file = 'file.txt';  
  if (($fd = fopen($file, "a") !== false)) { 
    fwrite($fd, 'message to be written' . "\n");   
    fclose($fd); 
  } 
  </code></pre>