我尝试执行以下代码:
$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);
}
我有这个错误:
The used command is not allowed with this MariaDB version
在MariaDB服务器上,但这并不意味着——只是MySQL的公共分支。
所以,我有
php.ini
客户:
mysqli.allow_local_infile = 1
mysql.allow_local_infile = 1
我在服务器上有:
SHOW GLOBAL VARIABLES LIKE 'local_infile';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile | ON |
+---------------+-------+
1 row in set (0.023 sec)
出了什么问题,如何解决?