Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
237 views
in Technique[技术] by (71.8m points)

mysql - PHP MySQLi can't load data local

I try to do this code:

$conn = mysqli_init();
mysqli_options($conn, MYSQLI_OPT_LOCAL_INFILE, true);
mysqli_real_connect($conn,'{HOST}','{USERNAME}','{PASSWD}','{DBNAME}');
$x = mysqli_query($conn, "LOAD DATA LOCAL INFILE '/var/www/sample.txt' INTO TABLE temp");
if($x){
    echo "OK";
}else{
    echo mysqli_error($conn);
}

and i have this error:

The used command is not allowed with this MariaDB version

On server MariaDB, but it's not mean - just public fork of MySQL. So, i have in php.ini on client:

mysqli.allow_local_infile = 1
mysql.allow_local_infile = 1

I have on server:

SHOW GLOBAL VARIABLES LIKE 'local_infile';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile  | ON    |
+---------------+-------+
1 row in set (0.023 sec)

What's wrong and how to resolve it ?

question from:https://stackoverflow.com/questions/65866448/php-mysqli-cant-load-data-local

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...