title: Using fopen and fwrite with Zend Framework?
body: <p>I'm attempting to check for file existence with Zend Framework and, if the file doesn't exist, have it be created.  Here's the code being used:</p>
  
  <pre><code>$filename = "/assessmentsFile/rubrics/$rubricID.php";
  $somecontent = "test";
  
  if (!$handle = fopen($filename, 'w+')) {
      echo "Cannot open file ($filename)";
      exit;
  }
  
  // Write $somecontent to our opened file.
  if (fwrite($handle, $somecontent) === false) {
     echo "Cannot write to file ($filename)";
     exit;
  }
  </code></pre>
  
  <p>However, I assume due to Zend's way of handling file structure, if a file doesn't exist it just spits out:</p>
  
  <blockquote>
    <p>Warning: fopen(/assessmentsFile/rubrics/1.php) [function.fopen]: failed to open stream: No such file or directory</p>
  </blockquote>
  
  <p>Because the fopen function isn't working, fwrite is unable to write the file.</p>
  
  <p>Is there another way of doing this?</p>