Given the following code:

$sql="SELECT convert_tz( a.stamp,'GMT','$tz' ) as ts, a.status,
             a.reason, a.tl
      INTO OUTFILE  '/tmp/result.csv'
      FIELDS TERMINATED BY ','
      ENCLOSED BY '\"'
      LINES TERMINATED BY '\n'
      FROM alerts a
      WHERE a.stamp BETWEEN ? AND ?
      ORDER BY a.stamp DESC";


 $sth = $dbh->prepare($sql);
 $rv = $sth->execute;

Can you tell me why I'm getting this error:

DBD::mysql::st execute failed: Can't create/write to file
'/tmp/result.csv' (Errcode: 2)

The code is running as a CGI under apache 2.2.10 on SUSE 11.1.  The
MySQL is 5.0.77.  The server is remote.  The SQL executes correctly from
the MySQL local client against the remote DB server (i.e. the result
file drops locally).

I have strange bald spots from pulling at my hair whilst googling for
answers.

Reply via email to