On Tue, May 12, 2009 at 5:40 PM, Bruce Ferrell <bferr...@baywinds.org> wrote:
> 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'

> 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)

You don't have create/write permissions to the /tmp directory on your
remote host as whatever user your remote host's CGI is running as.
You were expecting your SELECT INTO OUTFILE statement to write the
output file on the remote host, correct?

> 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).

Yes, because you most likely can write to your /tmp directory on your
local machine.  Try just opening a filehandle in a basic CGI script on
your remote host in the /tmp directory and see if it works or not.
I'm betting not.

Thanks,

Brian

Reply via email to