After trying all the recommended solutions to this problem, I found that the answer was to set the PDO::ATTR_EMULATE_PREPARES to true.
This eliminated the "unbuffered query" error, but then proceeded to report the "LOAD DATA LOCAL INFILE forbidden" error in the LOAD request.
The solution was to set the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY to true.
In short, your initial connection should look like this:
$conn = new PDO($data_source, $db_user, $db_password, array(PDO::ATTR_EMULATE_PREPARES => true, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_PERSISTENT));
I do not understand why these parameters are necessary, but they worked for me.
source share