Bug #54158 [Com]: MYSQLND + PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE
Edit report at https://bugs.php.net/bug.php?id=54158edit=1 ID: 54158 Comment by: chris dot de dot kok at gmail dot com Reported by:tamas at ideaweb dot hu Summary:MYSQLND + PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE Status: Closed Type: Bug Package:PDO related Operating System: Linux PHP Version:5.3.5 Assigned To:mysql Block user comment: N Private report: N New Comment: I still seem to have this problem on: PHP 5.4.17-1~precise+1 Ubuntu 12.04 Previous Comments: [2012-01-15 03:20:00] denis_truffaut at hotmail dot com ext/pdo_mysql/mysql_driver.c, line 635 : if (mysql_options(H-sergedit ver, MYSQL_OPT_LOCAL_INFILE, (const char *)local_infile)) { Should be local_infile = 1; if (mysql_options(H-sergedit ver, MYSQL_OPT_LOCAL_INFILE, (const char *)local_infile)) { You can achieve this dirty and quickly in doing : sudo sed -ie 's/if (mysql_options(H-server, MYSQL_OPT_LOCAL_INFILE/local_infile = 1;if (mysql_options(H-server, MYSQL_OPT_LOCAL_INFILE/g' ext/pdo_mysql/mysql_driver.c [2012-01-15 00:31:54] denis_truffaut at hotmail dot com I just compiled PHP 5.4 RC5, on a Debian 6... and the bug is still there :( [2011-10-20 12:57:11] denis_truffaut at hotmail dot com 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) [2011-10-18 16:35:31] richardpq at gmail dot com I don't get it, after 5.3.6 release was working? because I have 5.3.8 and it is no working https://bugs.php.net/bug.php?id=55737 [2011-09-09 07:03:01] and...@php.net This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=54158 -- Edit this bug report at https://bugs.php.net/bug.php?id=54158edit=1
Bug #54158 [Com]: MYSQLND + PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE
Edit report at https://bugs.php.net/bug.php?id=54158edit=1 ID: 54158 Comment by: denis_truffaut at hotmail dot com Reported by:tamas at ideaweb dot hu Summary:MYSQLND + PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE Status: Closed Type: Bug Package:PDO related Operating System: Linux PHP Version:5.3.5 Assigned To:mysql Block user comment: N Private report: N New Comment: I just compiled PHP 5.4 RC5, on a Debian 6... and the bug is still there :( Previous Comments: [2011-10-20 12:57:11] denis_truffaut at hotmail dot com 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) [2011-10-18 16:35:31] richardpq at gmail dot com I don't get it, after 5.3.6 release was working? because I have 5.3.8 and it is no working https://bugs.php.net/bug.php?id=55737 [2011-09-09 07:03:01] and...@php.net This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. [2011-09-02 13:53:30] and...@php.net Automatic comment from SVN on behalf of andrey Revision: http://svn.php.net/viewvc/?view=revisionamp;revision=316039 Log: Fix for Bug #54158 MYSQLND + PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE and a bunch of other small preprocessor fixes [2011-04-03 03:57:48] anthon dot pang at gmail dot com Sorry, you're right. My workaround is actually because MySQL is compiled with --enable-local-infile. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=54158 -- Edit this bug report at https://bugs.php.net/bug.php?id=54158edit=1
Bug #54158 [Com]: MYSQLND + PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE
Edit report at https://bugs.php.net/bug.php?id=54158edit=1 ID: 54158 Comment by: denis_truffaut at hotmail dot com Reported by:tamas at ideaweb dot hu Summary:MYSQLND + PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE Status: Closed Type: Bug Package:PDO related Operating System: Linux PHP Version:5.3.5 Assigned To:mysql Block user comment: N Private report: N New Comment: ext/pdo_mysql/mysql_driver.c, line 635 : if (mysql_options(H-sergedit ver, MYSQL_OPT_LOCAL_INFILE, (const char *)local_infile)) { Should be local_infile = 1; if (mysql_options(H-sergedit ver, MYSQL_OPT_LOCAL_INFILE, (const char *)local_infile)) { You can achieve this dirty and quickly in doing : sudo sed -ie 's/if (mysql_options(H-server, MYSQL_OPT_LOCAL_INFILE/local_infile = 1;if (mysql_options(H-server, MYSQL_OPT_LOCAL_INFILE/g' ext/pdo_mysql/mysql_driver.c Previous Comments: [2012-01-15 00:31:54] denis_truffaut at hotmail dot com I just compiled PHP 5.4 RC5, on a Debian 6... and the bug is still there :( [2011-10-20 12:57:11] denis_truffaut at hotmail dot com 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) [2011-10-18 16:35:31] richardpq at gmail dot com I don't get it, after 5.3.6 release was working? because I have 5.3.8 and it is no working https://bugs.php.net/bug.php?id=55737 [2011-09-09 07:03:01] and...@php.net This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. [2011-09-02 13:53:30] and...@php.net Automatic comment from SVN on behalf of andrey Revision: http://svn.php.net/viewvc/?view=revisionamp;revision=316039 Log: Fix for Bug #54158 MYSQLND + PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE and a bunch of other small preprocessor fixes The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=54158 -- Edit this bug report at https://bugs.php.net/bug.php?id=54158edit=1
Bug #54158 [Com]: MYSQLND + PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE
Edit report at https://bugs.php.net/bug.php?id=54158edit=1 ID: 54158 Comment by: denis_truffaut at hotmail dot com Reported by:tamas at ideaweb dot hu Summary:MYSQLND + PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE Status: Closed Type: Bug Package:PDO related Operating System: Linux PHP Version:5.3.5 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-18 16:35:31] richardpq at gmail dot com I don't get it, after 5.3.6 release was working? because I have 5.3.8 and it is no working https://bugs.php.net/bug.php?id=55737 [2011-09-09 07:03:01] and...@php.net This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. [2011-09-02 13:53:30] and...@php.net Automatic comment from SVN on behalf of andrey Revision: http://svn.php.net/viewvc/?view=revisionamp;revision=316039 Log: Fix for Bug #54158 MYSQLND + PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE and a bunch of other small preprocessor fixes [2011-04-03 03:57:48] anthon dot pang at gmail dot com Sorry, you're right. My workaround is actually because MySQL is compiled with --enable-local-infile. [2011-04-03 01:08:09] anthon dot pang at gmail dot com As a workaround, I use PDO::ATTR_EMULATE_PREPARES. With 5.2.17 and 5.3.6 (using mysqlndb), both LOAD DATA INFILE and LOAD DATA LOCAL INFILE work on my Ubuntu 10.04 box, using PDO_MYSQL and MYSQLI extensions. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=54158 -- Edit this bug report at https://bugs.php.net/bug.php?id=54158edit=1
Bug #54158 [Com]: MYSQLND + PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE
Edit report at https://bugs.php.net/bug.php?id=54158edit=1 ID: 54158 Comment by: richardpq at gmail dot com Reported by:tamas at ideaweb dot hu Summary:MYSQLND + PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE Status: Closed Type: Bug Package:PDO related Operating System: Linux PHP Version:5.3.5 Assigned To:mysql Block user comment: N Private report: N New Comment: I don't get it, after 5.3.6 release was working? because I have 5.3.8 and it is no working https://bugs.php.net/bug.php?id=55737 Previous Comments: [2011-09-09 07:03:01] and...@php.net This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. [2011-09-02 13:53:30] and...@php.net Automatic comment from SVN on behalf of andrey Revision: http://svn.php.net/viewvc/?view=revisionamp;revision=316039 Log: Fix for Bug #54158 MYSQLND + PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE and a bunch of other small preprocessor fixes [2011-04-03 03:57:48] anthon dot pang at gmail dot com Sorry, you're right. My workaround is actually because MySQL is compiled with --enable-local-infile. [2011-04-03 01:08:09] anthon dot pang at gmail dot com As a workaround, I use PDO::ATTR_EMULATE_PREPARES. With 5.2.17 and 5.3.6 (using mysqlndb), both LOAD DATA INFILE and LOAD DATA LOCAL INFILE work on my Ubuntu 10.04 box, using PDO_MYSQL and MYSQLI extensions. [2011-03-04 10:21:43] and...@php.net to be fixed after 5.3.6 is released The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=54158 -- Edit this bug report at https://bugs.php.net/bug.php?id=54158edit=1
Bug #54158 [Com]: MYSQLND + PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE
Edit report at http://bugs.php.net/bug.php?id=54158edit=1 ID: 54158 Comment by: anthon dot pang at gmail dot com Reported by:tamas at ideaweb dot hu Summary:MYSQLND + PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE Status: Analyzed Type: Bug Package:PDO related Operating System: Linux PHP Version:5.3.5 Assigned To:mysql Block user comment: N Private report: N New Comment: As a workaround, I use PDO::ATTR_EMULATE_PREPARES. With 5.2.17 and 5.3.6 (using mysqlndb), both LOAD DATA INFILE and LOAD DATA LOCAL INFILE work on my Ubuntu 10.04 box, using PDO_MYSQL and MYSQLI extensions. Previous Comments: [2011-03-04 10:21:43] and...@php.net to be fixed after 5.3.6 is released [2011-03-04 01:18:56] tamas at ideaweb dot hu Description: Hi, On php 5.3.x PDO LOAD DATA LOCAL INFILE support seems broken. Running the code below issues a warning: Warning: PDOStatement::execute(): LOAD DATA LOCAL INFILE forbidden in /home/tamas/percona/load3.php on line 17 This is coming from mysqlnd when CLIENT_LOCAL_FILES option is disabled. Looking at the trace file, PDO doesn't call mysql_options (set_client_option) to enable local infile support. I tracked down this is caused by the following ifdef in ext/pdo_mysql/mysql_driver.c: #ifdef MYSQL_OPT_LOCAL_INFILE if (mysql_options(H-server, MYSQL_OPT_LOCAL_INFILE, (const char *)local_infile)) { pdo_mysql_error(dbh); goto cleanup; } #endif MYSQL_OPT_LOCAL_INFILE is undefined hence the whole block which would enable local infile support is disabled. When the ifdef/endif line is commented out everything works. I also tested with mysqli, that is unaffected and works as expected. And a related bug to this one: http://bugs.php.net/46964 Configure Command = './configure' '--prefix=/home/tamas/percona/php53dbg' '--disable-all' '--with-pdo-mysql=mysqlnd' '--enable-debug' '--enable-pdo' '--with-mysqli=mysqlnd' '--with-mysql=mysqlnd' Thanks, Tamas Test script: --- define('MYSQL_ALL_DSN','mysql:host=10.8.0.1;dbname=c'); define('MYSQL_ALL_USER','a'); define('MYSQL_ALL_PASS','b'); $sql = 'LOAD DATA LOCAL INFILE \'/home/tamas/percona/testLoad.data\' INTO TABLE mail_message '. 'FIELDS TERMINATED BY \',\' OPTIONALLY ENCLOSED BY \'\' LINES TERMINATED BY \'\n\' '. '(priority, user_id, `to`, template_id, data, custom_text_hash, spam)'; $con = new PDO(MYSQL_ALL_DSN, MYSQL_ALL_USER, MYSQL_ALL_PASS, array( PDO::MYSQL_ATTR_LOCAL_INFILE = 1, )); $stmt = $con-prepare($sql); $stmt-execute(); -- Edit this bug report at http://bugs.php.net/bug.php?id=54158edit=1
Bug #54158 [Com]: MYSQLND + PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE
Edit report at http://bugs.php.net/bug.php?id=54158edit=1 ID: 54158 Comment by: anthon dot pang at gmail dot com Reported by:tamas at ideaweb dot hu Summary:MYSQLND + PDO MySQL requires #define MYSQL_OPT_LOCAL_INFILE Status: Analyzed Type: Bug Package:PDO related Operating System: Linux PHP Version:5.3.5 Assigned To:mysql Block user comment: N Private report: N New Comment: Sorry, you're right. My workaround is actually because MySQL is compiled with --enable-local-infile. Previous Comments: [2011-04-03 01:08:09] anthon dot pang at gmail dot com As a workaround, I use PDO::ATTR_EMULATE_PREPARES. With 5.2.17 and 5.3.6 (using mysqlndb), both LOAD DATA INFILE and LOAD DATA LOCAL INFILE work on my Ubuntu 10.04 box, using PDO_MYSQL and MYSQLI extensions. [2011-03-04 10:21:43] and...@php.net to be fixed after 5.3.6 is released [2011-03-04 01:18:56] tamas at ideaweb dot hu Description: Hi, On php 5.3.x PDO LOAD DATA LOCAL INFILE support seems broken. Running the code below issues a warning: Warning: PDOStatement::execute(): LOAD DATA LOCAL INFILE forbidden in /home/tamas/percona/load3.php on line 17 This is coming from mysqlnd when CLIENT_LOCAL_FILES option is disabled. Looking at the trace file, PDO doesn't call mysql_options (set_client_option) to enable local infile support. I tracked down this is caused by the following ifdef in ext/pdo_mysql/mysql_driver.c: #ifdef MYSQL_OPT_LOCAL_INFILE if (mysql_options(H-server, MYSQL_OPT_LOCAL_INFILE, (const char *)local_infile)) { pdo_mysql_error(dbh); goto cleanup; } #endif MYSQL_OPT_LOCAL_INFILE is undefined hence the whole block which would enable local infile support is disabled. When the ifdef/endif line is commented out everything works. I also tested with mysqli, that is unaffected and works as expected. And a related bug to this one: http://bugs.php.net/46964 Configure Command = './configure' '--prefix=/home/tamas/percona/php53dbg' '--disable-all' '--with-pdo-mysql=mysqlnd' '--enable-debug' '--enable-pdo' '--with-mysqli=mysqlnd' '--with-mysql=mysqlnd' Thanks, Tamas Test script: --- define('MYSQL_ALL_DSN','mysql:host=10.8.0.1;dbname=c'); define('MYSQL_ALL_USER','a'); define('MYSQL_ALL_PASS','b'); $sql = 'LOAD DATA LOCAL INFILE \'/home/tamas/percona/testLoad.data\' INTO TABLE mail_message '. 'FIELDS TERMINATED BY \',\' OPTIONALLY ENCLOSED BY \'\' LINES TERMINATED BY \'\n\' '. '(priority, user_id, `to`, template_id, data, custom_text_hash, spam)'; $con = new PDO(MYSQL_ALL_DSN, MYSQL_ALL_USER, MYSQL_ALL_PASS, array( PDO::MYSQL_ATTR_LOCAL_INFILE = 1, )); $stmt = $con-prepare($sql); $stmt-execute(); -- Edit this bug report at http://bugs.php.net/bug.php?id=54158edit=1