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) >>> >> >> 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. >> > [...] >> 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. >> >> > On a typical Unix-like system, EVERY user has write permissions on /tmp, > including the "nobody" user and the database and web server accounts. > The /tmp directory should have permissions 01777 (sticky, full access > for everyone). > > Possibly the web server and/or the MySQL server run in a chroot()ed > environment where /tmp does not exist or where the permissions are more > restrictive. > > Possibly a file named /tmp/result.csv already exists, but is owned by > another user, has the usual 0644 permissions (writeable only for the > user, group and world can read) or even stricter permissions, and thus > is not writeable for the web server / MySQL server account. > > Alexander >
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 suspect this is a mysql setting, but I'm not sure. Off to Google to research.