title: General error: 1 Can't create/write to file errcode:2
body: <p>I am trying to write a CSV file to <code>/var/www/VistaMind_CMStmp</code> and I get the error Message: <code>SQLSTATE[HY000]: General error: 1 Can't create/write to file '/VistaMind_CMS/tmp/app_users.csv' (Errcode: 2)</code></p>
  
  <p>I tried doing <code>chown mysql:mysql</code> <code>/var/www/VistaMind_CMS/tmp</code>, but that does not work. I do not want to modify my TMPDIR var in my.cnf, which is currently set to /var/www, but instead, I want MySQL to dump a database table to /var/www/VistaMind_CMS/tmp.</p>
  
  <p>Please help!</p>
  
  <p>My code is :</p>
  
  <pre><code>    $file_path = $this-&gt;view-&gt;baseUrl()."/../tmp/app_users.csv";
      $sql = "SELECT * FROM users INTO OUTFILE '".$file_path."' ".
              "FIELDS TERMINATED BY ','
              ENCLOSED BY '\"'
              LINES TERMINATED BY '\n'";
      $db = Zend_Registry::get('db');
      $stmt = $db-&gt;query($sql, array());
      echo "Done!!";
  </code></pre>