Re: unable to write from a select into outfile



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.

.



Relevant Pages

  • Re: unable to write from a select into outfile
    ... remote host as whatever user your remote host's CGI is running as. ... On a typical Unix-like system, EVERY user has write permissions on /tmp, including the "nobody" user and the database and web server accounts. ... Possibly the web server and/or the MySQL server run in a chrooted environment where /tmp does not exist or where the permissions are more restrictive. ...
    (perl.dbi.users)
  • Re: unable to write from a select into outfile
    ... remote host as whatever user your remote host's CGI is running as. ... including the "nobody" user and the database and web server accounts. ... The /tmp directory should have permissions 01777 (sticky, ...
    (perl.dbi.users)
  • Re: write with cURL
    ... as the global web server user and thus needs world write permissions ... Hence, any PHP script ran on another account, has the ... global or Apache group (it can still use Apache group to offer web root ...
    (alt.php)
  • Re: write with cURL
    ... This is assuming that the PHP script runs as ... the global web server user (and it surely does given the problem you ... the global web server user and thus needs world write permissions to ... and execute permissions. ...
    (alt.php)
  • Re: The info you requested
    ... > The folder permissions in my computer are set for read/write access. ... > upload a file from their computer to wherever the web server is. ...
    (microsoft.public.dotnet.languages.csharp)