[Phpmyadmin-devel] [Patch] Allow for "LOAD DATA INFILE" when using the PHP-bundled mysql client

Matthias Pigulla mp at webfactory.de
Mon Sep 20 03:39:02 CEST 2004


Hi all,

I hope this is the right place and right way to submit this patch?

As you probably know, MySQL has disabled the "LOCAL" option for "LOAD
DATA INFILE" statements for security reasons as of MySQL 3.23.49. To be
able to use "LOAD DATA LOCAL", you will have to add 

local-infile    = 1

to both you server's and client's my.cnf files. (Please be aware of the
security implications!)

However, when using the mysql client bundled with PHP, these settings
don't apply. Instead, you will have to pass the appropriate flag as an
extra parameter to mysql_connect.

This patch adds a new config directive
$cfg['Servers'][..]['infile_local'] = (TRUE | FALSE). Setting it to
"TRUE" enables the mysql client bundled with PHP to use "LOAD DATA
LOCAL" for this connection. 

Without having tested it, you should be able to use LOAD DATA LOCAL
without setting this option if you compiled PHP with
--with-mysql=/path/to/mysql (thus you did not use the client bundled
with PHP) and setup my.cnf correctly.

Even when passing the additional parameter to mysql_(p)connect, the use
of open_basedir may restrict its usage.

Besides that, there was a typo in mysql.dbi.lib.php that prevented
passing the $client_flags to mysql_(p)connect at all; so far, that
should have broken the use of MYSQL_CLIENT_COMPRESS.

Best regards,
Matthias






-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: phpadmin-infile.txt
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20040920/057b3cb0/attachment.txt>


More information about the Developers mailing list