LOAD DATA LOCAL security problem under Windows with PHP

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
davidklonski
Forum Contributor
Posts: 128
Joined: Mon Mar 22, 2004 4:55 pm

LOAD DATA LOCAL security problem under Windows with PHP

Post by davidklonski »

Hello

I am trying to load a file from a client to a server using the LOAD DATA LOCAL INFILE command.

Both the client and the server reside on the same machine.
I am using PHP5.0 which connects to MySQL5.0 via the extension dll.

When I place the txt file to be downloaded under the mysql data library, then everything works fine and I don't need the 'LOCAL' keyword. I just use:

Code: Select all

LOAD DATA INFILE 'file.txt' INTO TABLE table_name;
I would like to be free to place that file anywhere I want on the server.
However, if I omit the LOCAL keyword, the server assumes that the file is in its data directory.

I tried adding the LOCAL keyword and got an error saying:
The used command is not allowed with this MySQL version
After reading the manual, I understood that I need to compile the MySQL client with the --enable-local-infile option. The problem is that I am using Windows with a MySQL dll. What can I do now?

I also understood that there is a problem in using the PHP mysql libraries to load files in that way.

I would appreciate any help in that matter
regards
David
Post Reply