Problem with mySQL/PHP permissions

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Davewho
Forum Newbie
Posts: 1
Joined: Tue Oct 06, 2009 12:14 pm

Problem with mySQL/PHP permissions

Post 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?
User avatar
akuji36
Forum Contributor
Posts: 190
Joined: Tue Oct 14, 2008 9:53 am
Location: Hartford, Connecticut

Re: Problem with mySQL/PHP permissions

Post 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
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Problem with mySQL/PHP permissions

Post 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.
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply