The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

LOAD DATA INFILE problem

Discussion in 'General Discussion' started by jamesbond, Dec 3, 2003.

  1. jamesbond

    jamesbond Well-Known Member

    Joined:
    Oct 9, 2002
    Messages:
    738
    Likes Received:
    1
    Trophy Points:
    18
    I use this query in a PHP script to import a csv file


    $result = "
    LOAD DATA INFILE '$uploadlocation' INTO TABLE $table2
    FIELDS TERMINATED BY '$seperator'
    ENCLOSED BY '\"'
    LINES TERMINATED BY '\r\n'
    ";


    It's been working fine for a long time until now alll of a sudden this error popped up:
    Can't get stat of '/home/xxxx/public_html/data/xxxx.csv' (Errcode: 13)


    The user has File_priv set to yes.

    I even tried importing with the mysql root account but that didn't work either.

    Using LOAD DATA LOCAL INFILE gives : 1148: The used command is not allowed with this MySQL version, so that's not an option


    Any ideas?
     
  2. wayne_h

    wayne_h Registered

    Joined:
    Nov 6, 2003
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Tallahassee, FL
    Just a guess, but try LOAD DATA LOCAL INFILE instead of LOAD DATA INFILE.

    I had a situation where this feature broke in one of the upgrades of phpMyAdmin, and I had to back to my earlier version. Then a still later version added the option to do an alternate query with LOCAL included and it worked again.

    Wayne
     
  3. jamesbond

    jamesbond Well-Known Member

    Joined:
    Oct 9, 2002
    Messages:
    738
    Likes Received:
    1
    Trophy Points:
    18
    Unfortunately that doesn't work either (I mentioned that in my post)

    CPanel's phpMyAdmin does work with LOAD DATA LOCAL INFILE , but php scripts give the above mentioned errors.
     
  4. wayne_h

    wayne_h Registered

    Joined:
    Nov 6, 2003
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Tallahassee, FL
    Ah, sorry, I should have read your post more carefully. Odd that the query works in phpMyAdmin and not in your script. Wonder if there may be a clue to that mystery in phhMyAdmin's config file?

    Wayne
     
  5. jamesbond

    jamesbond Well-Known Member

    Joined:
    Oct 9, 2002
    Messages:
    738
    Likes Received:
    1
    Trophy Points:
    18
    Solved the problem

    For future reference:

    If you have Cpanel's webprotect feature enabled then LOAD DATA INFILE only works if the file that needs to imported is NOT located in the public_html directory.

    :)
     
Loading...

Share This Page