I am trying to write a CSV file to /var/www/VistaMind_CMStmp
and I get the error Message: SQLSTATE[HY000]: General error: 1 Can't create/write to file '/VistaMind_CMS/tmp/app_users.csv' (Errcode: 2)
I tried doing chown mysql:mysql
/var/www/VistaMind_CMS/tmp
, 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.
Please help!
My code is :
$file_path = $this->view->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->query($sql, array());
echo "Done!!";