Page 1 of 1

Problem with mySQL/PHP permissions

Posted: Tue Oct 06, 2009 12:47 pm
by Davewho
Win XP Pro, IIS, MySQL PHP 5.
I create a file from mySQL with ...SELECT ...INTO OUTFILE. Subsequently, I cannot delete it with unlink(). I get Warning: unlink(db_backup/temp.txt): Permission denied in D:\Coding\Web\CC\include\functions.php

Fileperms() on the file return 100666, and the file is reported as is_readable but not is_writable nor is_executable. Permission is also denied for chmod().

I can copy the file, and delete the copied file. The copied file has the same fileperms() and same combination of readable/writable/executable.

Where should I be looking, please?

Re: Problem with mySQL/PHP permissions

Posted: Thu Oct 15, 2009 11:45 am
by akuji36
I believe you be looking at mysql db ---- it has a privilege table.

Look into granting privileges to users and db.

see link below:

http://www.devshed.com/c/a/PHP/Doing-Mo ... -Part-1/5/

I use myphpadmin. Easier to control mysql

Re: Problem with mySQL/PHP permissions

Posted: Thu Oct 15, 2009 5:23 pm
by VladSun
http://dev.mysql.com/doc/refman/5.0/en/select.html
Note

Any file created by INTO OUTFILE or INTO DUMPFILE is writable by all users on the server host. The reason for this is that the MySQL server cannot create a file that is owned by anyone other than the user under whose account it is running. (You should never run mysqld as root for this and other reasons.) The file thus must be world-writable so that you can manipulate its contents.

If the secure_file_priv system variable is set to a nonempty directory name, the file to be written must be located in that directory.