php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68077 LOAD DATA LOCAL INFILE / open_basedir restriction
Submitted: 2014-09-22 19:02 UTC Modified: -
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: benoit dot chenu at gmail dot com Assigned:
Status: Closed Package: PDO MySQL
PHP Version: Irrelevant OS: Linux / Red Hat 5.10
Private report: No CVE-ID: None
 [2014-09-22 19:02 UTC] benoit dot chenu at gmail dot com
Description:
------------
When open_basedir is set (to whatever, / for exemple), we've can't send a "LOAD DATA LOCAL INFILE" sql command and got this error :

SQLSTATE[42000]: Syntax error or access violation: 1148 The used command is not allowed with this MySQL version

If the open_basedir directive is not set, the command works fine.

If we can't use open_basedir directive with this sql command (for security reasons), please update documentation.

Test script:
---------------
try {
	$pdo = new \PDO('mysql:host=127.0.0.1;dbname=test','test','test', array(
	        \PDO::MYSQL_ATTR_LOCAL_INFILE => true,
	        \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION
	));
	$pdo->query("LOAD DATA LOCAL INFILE '/tmp/test.csv' INTO TABLE test_table");
} catch(Exception $e) {
        echo $e->getMessage()."\n";
}


Actual result:
--------------
SQLSTATE[42000]: Syntax error or access violation: 1148 The used command is not allowed with this MySQL version

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-02-03 20:13 UTC] phpbugs2012 at joern dot heissler dot de
Duplicate of https://bugs.php.net/bug.php?id=62889
 [2015-11-16 09:02 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=be6fd4ba89e151b68ddd68e53d6a403c2e8eb862
Log: Fixed bug #68077 (LOAD DATA LOCAL INFILE / open_basedir restriction)
 [2015-11-16 09:02 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2015-11-16 10:00 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=be6fd4ba89e151b68ddd68e53d6a403c2e8eb862
Log: Fixed bug #68077 (LOAD DATA LOCAL INFILE / open_basedir restriction)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 10:01:30 2024 UTC