title: Unable to append (read and write) text file with php. Using fopen() and fwrite() together
body: <p>I recently installed Apache, PHP and started working on a small project. </p>
  
  <p>I have the following code. </p>
  
  <pre><code>&lt;?php 
  $tim=time();
  $ip=$_SERVER['REMOTE_ADDR'];
  $ipadd=$tim."IPaddress".$ip;
  
  $fp="user_log.txt";// file address
  
  $myfilea = fopen($fp,"a");//open file
  
  fwrite($myfilea,$ipadd.PHP_EOL);//add data to file
  echo fread($myfilea,filesize($fp));//read file
  fclose($myfilea);//close file
  ?&gt;
  </code></pre>
  
  <p>Here is what I can do... I can either use "a" mode to add text or I can use "r" mode to read text. I cant do both. I tried using "a+","r+","ar" etc.  </p>
  
  <p>Did I miss something during my setup ??? </p>
  
  <p>I am running this on windows 8.1. </p>
  
  <p>Thanks for your help.</p>