# LOAD DATA LOCAL INFILE from php

- Thread: https://externals.io/message/8337
- Original archive: https://news-web.php.net/php.internals/8337
- Started by lmartinez@eurolloyd.es on 2004-03-03T19:21:01+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #8337 — lmartinez@eurolloyd.es — 2004-03-03T19:21:01+00:00

URL: https://externals.io/message/8337#8337

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
