PDA

View Full Version : LOAD DATA LOCAL INFILE not working anymore?


MarkDeNyse
8-31-06, 04:02 PM
Hi all,

I've got a script that is calling mysql_db_query() using LOAD DATA LOCAL INFILE and suddenly it's failing with a 1148 error - started happening after 2pm EDT. This script hasn't been changed in eons so I know it's not a code change on my part. I'm wondering if it could have anything to do with the recent/current update to PHP?

Anyone else seeing this issue?

MarkDeNyse
9-1-06, 01:58 PM
Eesh. Am I the only one on PowWeb using LOAD DATA LOCAL INFILE or having this problem? I've created a test table and it still blows up with the 1148 error - which supposedly means this feature isn't allowed with the version of MySQL running. Since this has worked for YEARS on PowWeb (and even after we migrated), I'm really confused, plus phpmyadmin's system variables says 'local infile' is ON, so it should work.

Anyone got an idea? I'm really stuck here...

tacitman
9-1-06, 02:18 PM
I'm having the same problem with a script written years ago. LOAD DATA LOCAL INFILE worked the day before yesterday, but not last night or today. Please help!

MarkDeNyse
9-2-06, 12:08 PM
Googling around I found a comment dev.mysql.com that the problem I'm seeing is very likely that PHP was recompiled with a MySQL flag turned off. Since PowWeb just upgraded their PHP it seems likely to me that this is causing the problem. phpmyadmin does say local infile is ON, but will not work if PHP is recompiled with the flag off.

From http://dev.mysql.com/doc/refman/5.0/en/load-data-local.html
<<<
This topic often leads to problems in combination with PHP. If you followed one of the many documents which tell you to compile PHP with "--with-mysql", you didn't link against the MySQL libraries, but you're using the internal MySQL client of PHP, which seems to cause trouble, even if the MySQL server is correctly built with "--enable-local-infile".

Recompiling PHP with "--with-mysql=/usr" solved the problem instantly, because it links against the original MySQL libraries with local file handling enabled. No further configuration needed.
>>>

I have opened a ticket on this, but of course support is taking their time and wasting mine by requesting my username/password.

PowWeb, if you're out there and read this - please look into this. I think it's very likely your PHP upgrade has caused this feature to be shut off.

MarkDeNyse
9-2-06, 12:40 PM
* SOLUTION *

Further digging on dev.mysql.com provided this:

<<<
You can use LOAD DATA LOCAL with recent versions of PHP without recompiling PHP.

Passing 128 (the value of the CLIENT_LOCAL_FILES constant) as the fifth parameter to mysql_connect () enables LOAD DATA LOCAL on the client side.

Example: $dbh = mysql_connect($server, $user, $pass, false, 128);

For PHP 4.3 and above.
>>>

I have tested this on my solution and it works as before.

tacitman
9-4-06, 10:55 AM
Your solution works!! Thank you Mr. MarkDeNyse so very much for your effort in this case!