Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8737789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:36:05+00:00 2026-06-13T10:36:05+00:00

We’re moving our database from being on the webserver to a separate server (from

  • 0

We’re moving our database from being on the webserver to a separate server (from an Amazon EC2 webserver to an RDS instance.)

We have a LOAD DATA INFILE that worked before that is going to need the LOCAL keyword added now that the database will be on a different machine to the webserver.

Testing on my dev server, it turns out that it doesn’t work:

  • I can still LOAD DATA INFILE from php as I have been
  • I can LOAD DATA LOCAL INFILE from mysql commandline (with –local_infile=1)
  • I can’t LOAD DATA LOCAL INFILE from php.

Between those 2 things that do work, it rules out:

  • problems with the sql or php code
  • problems with the upload file, including syntax and file permissions
  • mysql server settings problems

The error I get is:
ERROR 1148 (42000): The used command is not allowed with this MySQL version
(I get that error from the mysql commandline if I don’t use –local_infile=1)


A few other bits of relevant info:

  • Ubuntu 12.04, mysql 5.5.24, php 5.3.10
  • I’m using php’s mysql_connect (instead of mysqli, because we’re planning on using facebook’s hiphop compiler which doesn’t support mysqli.)
  • Because of that, the connect command needs an extra flag set:

    mysql_connect($dbHost, $dbUser, $dbPass, false, 128);
    
  • I’ve used phpinfo() to confirm that mysql.allow_local_infile = On
  • I’ve tried it on Amazon RDS (in case it was a problem in my dev server) and it doesn’t work there either. (With the local_infile param turned on.)

The only thing I’ve read about that I haven’t tried is to compile mysql server on my dev server with the flag turned on to allow local infile… but even if I get that working on my dev server it’s not going to help me with Amazon RDS. (Besides which, LOAD DATA LOCAL INFILE does work from the mysql commandline.)


It seems like it’s specifically a problem with php’s mysql_connect()

Anybody using LOAD DATA LOCAL INFILE (maybe from Amazon RDS) that knows the trick to getting this to work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:36:06+00:00Added an answer on June 13, 2026 at 10:36 am

    I’ve given up on this, as I think it’s a bug in php – in particular the mysql_connect code, which is now deprecated. It could probably be solved by compiling php yourself with changes to the source using steps similar to those mentioned in the bug report that @eggyal mentioned: https://bugs.php.net/bug.php?id=54158

    Instead, I’m going to work around it by doing a system() call and using the mysql command line:

    $sql = "LOAD DATA LOCAL INFILE '$csvPathAndFile' INTO TABLE $tableName FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\\\"' ESCAPED BY '\\\\\\\\' LINES TERMINATED BY '\\\\r\\\\n';";
    system("mysql -u $dbUser -h $dbHost --password=$dbPass --local_infile=1 -e \"$sql\" $dbName");
    

    That’s working for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view passing on information from a database: def serve_article(request, id): served_article
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a text area in my form which accepts all possible characters from
I have a reasonable size flat file database of text documents mostly saved in
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a small JavaScript validation script that validates inputs based on Regex. I
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.