0

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 ?

odd90058
  • 5
  • 4
  • Does your user have the necessary permissions? See https://stackoverflow.com/questions/61532908/the-used-command-is-not-allowed-with-this-mariadb-version-with-local-infile-on – Dharman Jan 24 '21 at 13:10
  • Does this help? https://stackoverflow.com/questions/12819098/error-1148-mysql-the-used-command-is-not-allowed-with-this-mysql-version – Dharman Jan 24 '21 at 13:12
  • i repeat it from cli version - all ok. what's wrong with php ? – odd90058 Jan 24 '21 at 19:27
  • what mariadb version is it ? –  Mar 14 '21 at 18:52

0 Answers0