1

LOAD DATA LOCAL INFILE is forbidden, check mysqli.allow_local_infile

I am facing this issue in live server while uploading a csv. But i have no problem while running this in my local machine. After searching the issue i found many people suggest to change

'mysqli.allow_local_infile = Off'

to 'On' in php.ini I have changed it but still now unable to get rid off this problem.

LOAD DATA LOCAL INFILE '/home3/xxx/public_html/zzz/apps/assets/uploads/excel/contacts.csv' INTO TABLE tbl_users FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES (fname, lname, email)

My live server php version is PHP Version 7.4.20

rup
  • 37
  • 2
  • Please check the duplicate carefully, it mentions a couple of other points (configuring the database server to accept this to begin with, and also specifying it when making the database connection.) – CBroe Jun 17 '21 at 10:34
  • `allow_local_infile` must be enabled both on the client side (PHP in your case) and on server side (edit my.ini or daemon command line options). – Akina Jun 17 '21 at 10:36
  • 1
    @akina, thanks for your comment, i have changed this value in my php.ini file in my server. But still have the problem – rup Jun 17 '21 at 11:08
  • *i have changed this value in my php.ini file in my server.* This is a half of work. Have you checked or reconfigured MySQL server? – Akina Jun 17 '21 at 11:23
  • @Akina, no i have not, what should i have to do in MYSQL server? Should i have to restart it? – rup Jun 17 '21 at 12:23
  • 1
    *what should i have to do in MYSQL server?* Either edit my.ini and add `local_infile=ON` into [mysql] section or add `--local-infile=ON` option to service command line or execute `SET SESSION local_infile=ON;` within your connection before executing LOAD DATA. See https://dev.mysql.com/doc/refman/8.0/en/load-data-local-security.html – Akina Jun 17 '21 at 12:28
  • @Akina, thanks for your instruction. My Database client version: libmysql - 5.6.43, should i have to reconfigured this? As your mysql version is 8 i think. One more thing how can i get my.ini in my BlueHost server have you any idea? – rup Jun 17 '21 at 12:39
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/233894/discussion-between-rup-and-akina). – rup Jun 17 '21 at 13:01

0 Answers0