On 2009-05-13 08:14:09 -0700, Bruce Ferrell wrote: > Alexander Foken wrote: > > On 13.05.2009 02:59, Brian Manning wrote: > >> > >>> 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) > >>> [...] > I figured it out and you guys are gonna love this. Yes, it was > permissions; No, not on the web server machine where the CGI was > executing. To Recap, CGI/web server on one machine, database on a > remote machine. SQL executed from MySQL command line on the > CGI/Webserver drops the outfile in the expected place... happy, joyous > and free. The SQL, when executed from the CGI program drops the outfile > on the database machine. The permission errors were because the target > directory didn't exist on the database machine. > > Now, the question is how do I get the CGI to drop the outfile on the > machine where the CGI executes?
I think you mean: How do I get the *database* to drop the outfile on the
machine where the CGI executes?
You don't. The database can only write files within its own file system.
There are three possibilities:
1) write the file to a file system accessible over the network from both
the database and the webserver. This might be a directory on one of
the two machines exported to the other via NFS (or whatever network
filesystem you mistrust least) or on a file server accessible by
both.
2) copy the file from the database server to the web server, for example
with scp or rsync.
3) forget about "select into outfile". Use a normal select and process
the results in the CGI script.
hp
--
_ | Peter J. Holzer | Auf jedem Computer sollte der Satz Ludwigs II
|_|_) | Sysadmin WSR | eingeprägt stehen: "Ein ewig Rätsel will ich
| | | [email protected] | bleiben, mir und andern."
__/ | http://www.hjp.at/ | -- Wolfram Heinrich in desd
pgpFUl903Qyct.pgp
Description: PGP signature
