Edit report at https://bugs.php.net/bug.php?id=55737&edit=1
ID: 55737 Comment by: denis_truffaut at hotmail dot com Reported by: stefan dot kaifer at hartmann dot info Summary: LOAD DATA LOCAL INFILE - The used command is not allowed with this MySQL versio Status: Feedback Type: Bug Package: MySQL related Operating System: opensuse 11.0 PHP Version: 5.3.8 Assigned To: mysql Block user comment: N Private report: N New Comment: Some bug fix is planned for PHP 5.4 : http://php.net/releases/NEWS_5_4_0_beta1.txt - PDO MySQL driver: . Fixed bug #54158 (MYSQLND+PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE) (Andrey) Previous Comments: ------------------------------------------------------------------------ [2011-10-19 02:30:15] richardpq at gmail dot com No, I dont have enable, my php.ini: ; open_basedir, if set, limits all file operations to the defined directory ; and below. This directive makes most sense if used in a per-directory ; or per-virtualhost web server configuration file. This directive is ; *NOT* affected by whether Safe Mode is turned On or Off. ; http://php.net/open-basedir ;open_basedir = Also has the first guy said... I can use LOAD DATA LOCAL INFILE, from MySql client but not from an application using PHP. ------------------------------------------------------------------------ [2011-10-18 20:23:34] and...@php.net mysqlnd allows LOAD DATA LOCAL in all cases but if open_basedir is enabled. If open_basedir is set it is disabled regardless where the file to be loaded resides. This might be too strict for shared envs. Do you have open_basedir enabled? ------------------------------------------------------------------------ [2011-10-18 16:27:34] denis_truffaut at hotmail dot com Related bugs : https://bugs.php.net/bug.php?id=46964 https://bugs.php.net/bug.php?id=54158 A PHP Dev said it was resolved in 5.3.6, but it came back. As it is a very common usage of MySQL, especialy to save/import data, it had to be fixed in priority. The override PDO::MYSQL_ATTR_LOCAL_INFILE => 1 also doesn't not work. What to do ?! :O ------------------------------------------------------------------------ [2011-10-03 21:08:08] richardpq at gmail dot com Hi I have exact the same problem, like you I compile php using those options, I have the same php version and mysql 5.5.15, have you resolve the problem? ------------------------------------------------------------------------ [2011-09-20 09:49:56] stefan dot kaifer at hartmann dot info Description: ------------ Hello I've compiled php myself with this command: ./configure --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd .... Now my php-applications can't use "LOAD DATA LOCAL INFILE '/tmp/import-20110919173927-78613.txt' INTO TABLE ..." anymore! On the command prompt I can use "LOAD DATA LOCAL INFILE", that means mysql server allows me to use "LOAD DATA LOCAL INFILE", the server variable "local infile" is setted to "ON" (with "local-infile=1" in the my.cnf). It seems a php-mysqlnd problem. Neither the mysql nor the mysqli extensions allows me to use "LOAD DATA LOCAL INFILE". This is the Connect-line in my code: $Connect = mysql_connect($DB_Host .":".$DB_Port,$DB_User,$DB_Password, FALSE, 128); The error is: #1148 - The used command is not allowed with this MySQL version Mysql-server: 5.5.16 PHP: 5.3.8 PHP-MYSQL-client: mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735 $ PHPINFO: mysql MySQL Support enabled Active Persistent Links 0 Active Links 0 Client API version mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735 $ Directive Local Value Master Value mysql.allow_local_infile On On mysql.allow_persistent Off Off mysql.connect_timeout 60 60 mysql.default_host no value no value mysql.default_password no value no value mysql.default_port no value no value mysql.default_socket no value no value mysql.default_user no value no value mysql.max_links Unlimited Unlimited mysql.max_persistent Unlimited Unlimited mysql.trace_mode Off Off mysqli MysqlI Support enabled Client API library version mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735 $ Active Persistent Links 0 Inactive Persistent Links 0 Active Links 0 Directive Local Value Master Value mysqli.allow_local_infile On On mysqli.allow_persistent On On mysqli.default_host no value no value mysqli.default_port 3306 3306 mysqli.default_pw no value no value mysqli.default_socket no value no value mysqli.default_user no value no value mysqli.max_links Unlimited Unlimited mysqli.max_persistent Unlimited Unlimited mysqli.reconnect Off Off mysqlnd mysqlnd enabled Version mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735 $ Compression supported SSL supported Command buffer size 4096 Read buffer size 32768 Read timeout 31536000 Collecting statistics Yes Collecting memory statistics No Tracing n/a I hope, that somebody can help. Best regards Stefan Test script: --------------- $Connect = mysql_connect($DB_Host .":".$DB_Port,$DB_User,$DB_Password, FALSE, 128); $StrSQL = "LOAD DATA LOCAL INFILE '/tmp/test.txt' INTO TABLE testtable FIELDS TERMINATED BY '</td><td>' LINES STARTING BY '<tr><td>' TERMINATED BY '</td></tr>' IGNORE 1 LINES ....."; $Result1 = mysql_db_query($DB,$StrSQL,$Connect); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55737&edit=1