Bug #67475 [Opn->Dup]: load data local infile fails with pdo_mysql, works with mysqli

From: Date: Fri, 11 Dec 2020 10:42:02 +0000
Subject: Bug #67475 [Opn->Dup]: load data local infile fails with pdo_mysql, works with mysqli
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231011@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67475&edit=1 ID: 67475 Updated by: nikic@php.net Reported by: jaroslav at thinline dot cz Summary: load data local infile fails with pdo_mysql, works with mysqli -Status: Open +Status: Duplicate Type: Bug Package: PDO MySQL Operating System: Linux PHP Version: 5.5.13 Block user comment: N Private report: N New Comment: Duplicate of bug #62889 per above comment. Previous Comments: ------------------------------------------------------------------------ [2015-02-03 20:13:04] phpbugs2012 at joern dot heissler dot de Duplicate of https://bugs.php.net/bug.php?id=62889 ------------------------------------------------------------------------ [2014-06-19 09:13:44] jaroslav at thinline dot cz Description: ------------ Using SQL statement LOAD DATA LOCAL INFILE with PDO doesn't work, an error "SQLSTATE[42000]: Syntax error or access violation: 1148 The used command is not allowed with this MySQL version" is returned even with PDO::MYSQL_ATTR_LOCAL_INFILE set to 1 in constructor. When trying the same with mysqli extension however, everything is executed correctly and test table is filled with data. PHP is running on Debian Wheezy, using package from dotdeb.org Test script: --------------- // Non-functional with PDO try { $con = new PDO("mysql:host=127.0.0.1;dbname=testdb", "user", "pass", array(PDO::MYSQL_ATTR_LOCAL_INFILE => 1)); $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $con->exec('load data local infile \'test.csv\' into table testtable fields terminated by \',\' enclosed by \'"\' escaped by \'"\''); } catch (PDOException $e) { echo $e->getMessage(); } //Functional with mysqli $con = mysqli_init(); mysqli_options($con, MYSQLI_OPT_LOCAL_INFILE, true); mysqli_real_connect($con, '127.0.0.1', 'user', 'pass', 'testdb'); mysqli_query($con, 'load data local infile \'test.csv\' into table testtable fields terminated by \',\' enclosed by \'"\' escaped by \'"\''); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67475&edit=1

« previous php.bugs (#231011) next »