php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7244 Problem with LOAD DATA LOCAL INFILE
Submitted: 2000-10-16 10:51 UTC Modified: 2002-07-18 01:00 UTC
Votes:16
Avg. Score:3.9 ± 1.5
Reproduced:7 of 7 (100.0%)
Same Version:2 (28.6%)
Same OS:3 (42.9%)
From: c dot schmidt-koester at gmx dot net Assigned:
Status: No Feedback Package: MySQL related
PHP Version: 4.1.0 OS: win 98
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: c dot schmidt-koester at gmx dot net
New email:
PHP Version: OS:

 

 [2000-10-16 10:51 UTC] c dot schmidt-koester at gmx dot net
I'm using Win98, Apache 1.3.9, MySQL 3.23-beta and PHP4.0.3.

Since PHP4.0.3 there is a problem with import data to MySQL (LOAD DATA LOCAL INFILE). It seems that PHP is filtering out all slashes of the file path, so MySQL can't find the file.

mysql_error() and mysql_errno() say something like this

"File 'e:TempphpA154.TMP' not found (Errcode: 2)"

LOAD DATA INFILE (without LOCAL) seems to be ok.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-04 10:41 UTC] c dot schmidt-koester at gmx dot net
With

$file = addslashes ($file);

it works.
 [2001-01-04 10:52 UTC] derick@php.net
User reported that it works if he does:

$file = addslashes ($file)



So this was a user error.
 [2001-01-04 11:02 UTC] eschmid@php.net
No, the original problem persists. Adding addslashes is only a temporary solution. This breaks some existing programs.

-Egon
 [2001-01-12 08:14 UTC] cynic@php.net
did you switch by any chance from php.ini-dist to php.ini-optimized when you upgraded your PHP to 4.0.3?
 [2001-01-12 13:21 UTC] cynic@php.net
user feedback:

No, I didn't.
I've also got an old version of PHP 4.0.2 installed and I can switch between both versions via ScriptAlias in httpd.conf (php.ini is still the same). With PHP 4.0.2 it's all working fine but with PHP 4.0.4 there is that problem.

 [2001-06-02 23:06 UTC] sniper@php.net
Does this happen with PHP 4.0.5 ?

 [2001-06-03 13:58 UTC] c dot schmidt-koester at gmx dot net
Yes, it also happens with PHP 4.0.5
 [2001-11-20 19:53 UTC] mfischer@php.net
Can you please test if the problem still persists with latest RC?

http://phpuk.org/~james/php-4.1.0RC3-win32.zip

If not, can you provide more details (like the actual query you are using).

Feedback.
 [2001-11-24 14:30 UTC] c dot schmidt-koester at gmx dot net
> Can you please test if the problem still persists with
> latest RC?

> http://phpuk.org/~james/php-4.1.0RC3-win32.zip

I'm sorry, but I wasn't able to get this version running. I tried with the latest stable release 4.0.8 and the problem was still there.

> If not, can you provide more details (like the actual
> query you are using).

The query is: LOAD DATA LOCAL INFILE '$textfile' INTO TABLE $table


 [2001-11-24 21:03 UTC] mfischer@php.net
What was the problem with the RC?

And, this is query, but what is the actual *ERROR* you get? mysql_error() might tell you more.

Feedback.
 [2001-11-25 08:14 UTC] c dot schmidt-koester at gmx dot net
Like I wrote in my first bug report on 2000-10-16 mysql_error() and mysql_errno() say something like this

"File 'e:TempphpA154.TMP' not found (Errcode: 2)"

You can see that all slashes in the temporary filename are removed what causes a problem.
 [2001-11-25 18:21 UTC] sniper@php.net
I'm just wondering why is using addslashes() 'temporary solution' ??


 [2001-11-26 14:01 UTC] c dot schmidt-koester at gmx dot net
In privious releases addslashes() was not necessary. Even phpMyAdmin got problems and had to be changed.
 [2001-12-08 23:52 UTC] sniper@php.net
Could you please add a diff to the php.ini-dist against the php.in
you're running PHP with?


 [2001-12-09 07:23 UTC] c dot schmidt-koester at gmx dot net
I just tried with the original php.ini-dist and the problem is still there. Only the error message changes in "File 'c:win98tempphp130.tmp' not found (Errcode: 2)" due to the missing alternate upload_dir.

 [2002-01-14 19:24 UTC] jmplus at yfolire dot net
Same problem with PHP 4.1.0, Apache 1.3.22 and MySQL 3.21.29a under Win 98.
Action made with phpMyAdmin 2.2.2 and phpMyAdmin 2.0.3.
 [2002-01-14 22:00 UTC] yohgaki@php.net
Please update PHP Version if you've tested with newer version :)
 [2002-06-17 13:35 UTC] derick@php.net
Is this still a problem with PHP 4.2.1?

Derick
 [2002-06-17 16:04 UTC] sniper@php.net
Rather try the latest CVS snapshot build:

http://snaps.php.net/win32/php4-win32-latest.zip

 [2002-07-18 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2002-10-18 23:53 UTC] manteau at grafix dot nl
I am having a problem wich is likewise I think
Loading data from a windows host to a linux server

echo "<input type=\"hidden\" name=\"file1\" value=\"D:\gegevens.txt\">";

$file1 = str_replace("\\" , "\\\\", $file1);

$result=mysql_query ("LOAD DATA LOCAL INFILE '$file1' INTO TABLE agenda (plaats, activiteit)");

returns this: File 'D:\\gegevens.txt' not found (Errcode: 2)

If I do the same on the mysql server wich runs on windows at home and type in the mysql monitor:

load data local infile 'D:\\gegevens.txt' into table agenda;

everything works fine.

So the location with the extra backslash should work....


I spend a lot of time on this and tried about everything and can't figure it out.
 [2003-03-20 16:47 UTC] neron_cl at yahoo dot com
I had the same problem, and this works me:

LOAD DATA LOCAL INFILE "c:/MYSQL/file.txt" INTO TABLE $table FIELDS TERMINATED BY ';'
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 02 12:01:29 2024 UTC