title: fopen is not working on elastic beanstalk php
body: <p>I am using the following code in elastic beanstalk php to generate log file but I am getting this error.But the same code is working on another server. How can I make it work ? </p>
  
  <p>Error:</p>
  
  <pre><code>Error opening file in write mode!
  </code></pre>
  
  <p>Code  :</p>
  
  <pre><code>$path="/var/www/html/aws";
  $fileName =$path.'/logs/data'.date('Y-m-d_H-i-s'). '_' . uniqid() . '.txt';
  $file = fopen($fileName,'w') or die('Could not create report file: ' . $fileName);
  foreach($_POST as $key =&gt; $value) {
      $reportLine = $key." = ".$value."\n";
      fwrite($file, $reportLine) or die ('Could not write to report file ' . $reportLine);
  }
  
  fputs($file,"log aws");
  fclose($file);
  </code></pre>