LOAD DATA LOCAL INFILE from php

php.internals

Luis Martinez Ordoñez

22 years ago
I have a RedHat 7.3 with a mysql-3.23.49-3 and php-4.1.2-7 mysql was installed as an rpm, that have --local-infile=0 as default. I´m trying to load a csv file into mysql from a php script, trying not to install again mysql from source, nor rebuild the rpm package. So I found that if I make the connect script in php as mentioned in bugs.php.net forum: if you made a connection with mysql_connect() and specify 128 as fifth parameter (options), you can perform sql LOAD DATA LOCAL INFILE statements. the file accesses are made by mysql client library, so you can access any file which webserver process can access to, IGNORING open_basedir option! (and perhaps also safe-mode uid/gid checks, i don't know...) $m=mysql_connect($host, $user, $pass, false, 128); // connect with MYSQL_OPT_LOCAL_INFILE (in php manual undocumented) option it doesn´t work, displaying an error. Any suggestions? Do I need to install mysql with the --local-infile option turned on for proper operation? The database in for internal use only, in an intranet, without public access. Thanks in advance. -------------------------- Luis Martínez Ordoñez