Using Ubuntu Server 14.04 x64 / PHP 5.5.9-1ubuntu4 (cli) w/ FPM / MySQL InnoDB version 5.5.35
I've created a PHP script that downloads a text file from a remote server and then attempts to import it with the LOAD DATA LOCAL INFILE '/path/to/file.txt' INTO TABLE test FIELDS TERMINATED BY '\n'.
I've gone through the process of modifying the php.ini file:
[MySQL]
; Allow accessing, from PHP's perspective, local files with LOAD DATA statements
; http://php.net/mysql.allow_local_infile
mysql.allow_local_infile = On
I've modified my.cnf (both [mysql] and [mysqld] entries):
local-infile=1
local-infile
I've run MySQL from the terminal and then issue:
SET GLOBAL local_infile = 'ON';
I've manually started and stopped MySQL with:
sudo /etc/init.d/mysql start --enable-local-infile
After each of these commands I can run SHOW GLOBAL VARIABLES LIKE 'local_infile'; and it always says the value is ON. I have no problem whatsoever executing my LOAD DATA command from MySQL prompt but if I try to run the LOAD DATA stored in a PHP file it errors out with:
The used command is not allowed with this MySQL version
From what I've read, there seems to be a few who suggest to recompile PHP with "--with-mysql=/usr" but that seems like a real sledge hammer approach to me, maybe I'm wrong. I can issue ANY MySQL query except for that that from a PHP file. What am I doing wrong?