Avatar billede blobby Nybegynder
17. december 2004 - 17:19

php's samarbejde med MYSQL virker åbenbart ikke.

Jeg sidder og skal til at prøve at sætte et CSV dokument fra excel in i min mysql database.
Komandoen jeg prøver at bruge er 

"LOAD DATA LOCAL INFILE '/penge/mad2.csv' INTO TABLE `mad` FIELDS TERMINATED BY ';' LINES TERMINATED BY '\r\n'"

jeg har indtaste komandoen i et script der følger med bogen php  mysql for dummies (kan ses her: http://janet.valade.com/proginbook2/mysql_send.php.txt) det plejer at virke fint nok.

Jeg for så fejlkoden "Error 1148: The used command is not allowed with this MySQL version" jeg har så kigget i MYSQL manualen og der er så nogle der har skrevet neden under
"
Posted by [name withheld] on August 21 2003 7:33am    [Delete] [Edit]

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.
Posted by [name withheld] on October 4 2003 8:13pm    [Delete] [Edit]

In a word...LAME!

The lack of usable examples for overcoming this "security improvement"is INEXCUSABLE! Especially given how widely this function is used....

I lost 4 hours and 1 client because a simple DB import via PHP that used to work no longer does.. The IRS manual makes more sense than the docs for "LOAD DATA [LOCAL]"

Let me elaborate what took forever to find out..(*NIX)

1=ON; 0=OFF; LOCAL != PHP;

LOAD DATA INFILE '/full_path_to_file/your_file.txt' INTO TABLE your_table

You MUST have a compiled MySQL with '--enable-local-infile '

You MUST have compiled PHP using the full path to MySQL, otherwise it will use it's internal handlers, which don't work with the "new" LOAD DATA.

--with-mysql=/usr/local/mysql (assuming your MySQL is located here)

You MUST start the MySQL daemon with the option '--local-infile=1'

Given the $time I lost fighting this I could have paid to buy a LOCKED SAFE to put my server in for for security... (Or bought a SQL license...<harsh>)

Next time folks, think features/performance/compatibility when "upgrading"..

Just when we started to convince users that the open-source approach was viable....

Don't get me wrong, I love this stuff...
"

Mit endelige spørgsmål er så hvordan for jeg aktiveret/gjort sådan som de siger med hensyn til "--with-mysql" og 1=ON; 0=OFF; LOCAL != PHP;
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester