Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1380794

Summary: mysql LOAD DATA LOCAL INFILE fails when PHP's open_basedir is set
Product: Red Hat Enterprise Linux 6 Reporter: David Mulford <dmulford>
Component: phpAssignee: Remi Collet <rcollet>
Status: CLOSED WONTFIX QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.8CC: cww, rcollet
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-07 22:17:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
.tar.xz file containing three files used to reproduce the issue none

Description David Mulford 2016-09-30 14:45:02 UTC
Created attachment 1206308 [details]
.tar.xz file containing three files used to reproduce the issue

Description of problem:
Trying to use LOAD DATA LOCAL INFILE fails when PHP's open_basedir setting is non-empty. More details in this PHP bug: https://bugs.php.net/bug.php?id=62889

Version-Release number of selected component (if applicable):
php54-2.0-1.el6.x86_64
mysql-server-5.1.73-7.el6.x86_64
php54-php-mysqlnd-5.4.40-4.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Setup mysql and install php with mysqlnd drivers
2. Create a table in the "test" database using the attached create-rhel-tables.sql
3. Set open_basedir in /opt/rh/php54/root/etc/php.ini
4. Edit the attached sample.php to look at the open_basedir value set in step #3
5. Run the attached sample.php with `php sample.php`

Actual results:
The query fails with error 1148 "The used command is not allowed with this MySQL version"

Expected results:
The query is executed and runs as expected, affecting 3 rows.

Additional info:
Using the LOAD DATA LOCAL INFILE from the mysql command line tool works. This also works if the open_basedir setting in PHP is disabled.

The second comment of the linked PHP bug lists a workaround that doesn't work. According to PHP's documentation on PDO::MYSQL_ATTR_READ_DEFAULT_GROUP [1], this option is not read when using mysqlnd.

[1] http://php.net/manual/en/ref.pdo-mysql.php

Comment 3 Remi Collet 2016-10-03 05:51:40 UTC
I can reproduce with 5.4 and 5.5

$ scl enable php54 bash
$ php sample.php 
Query run successfully. 2 rows affected
$ php -d open_basedir=/home sample.php 
Query failed: ERRNO=(1148) The used command is not allowed with this MySQL version
$ php -d open_basedir=/tmp sample.php 
Query failed: ERRNO=(1148) The used command is not allowed with this MySQL version

$ scl enable php55 bash
$ php sample.php 
Query run successfully. 2 rows affected
$ php -d open_basedir=/home sample.php 
Query failed: ERRNO=(1148) The used command is not allowed with this MySQL version
$ php -d open_basedir=/tmp sample.php 
Query failed: ERRNO=(1148) The used command is not allowed with this MySQL version

Newer versions work as expected

$ scl enable rh-php56 bash
$ php sample.php 
Query run successfully. 2 rows affected
$ php -d open_basedir=/home sample.php 
Query run successfully. 2 rows affected
$ php -d open_basedir=/tmp sample.php 
Query failed: ERRNO=(2000) open_basedir restriction in effect. Unable to open file

$ scl enable rh-php70 bash
$ php sample.php 
Query run successfully. 2 rows affected
$ php -d open_basedir=/home sample.php 
Query run successfully. 2 rows affected
$ php -d open_basedir=/tmp sample.php 
Query failed: ERRNO=(2000) open_basedir restriction in effect. Unable to open file

Comment 8 Chris Williams 2017-06-07 22:17:40 UTC
Red Hat Enterprise Linux 6 transitioned to the Production 3 Phase on May 10, 2017.  During the Production 3 Phase, Critical impact Security Advisories (RHSAs) and selected Urgent Priority Bug Fix Advisories (RHBAs) may be released as they become available.

The official life cycle policy can be reviewed here:

http://redhat.com/rhel/lifecycle

This issue does not appear to meet the inclusion criteria for the Production Phase 3 and will be marked as CLOSED/WONTFIX. If this remains a critical requirement, please contact Red Hat Customer Support to request a re-evaluation of the issue, citing a clear business justification.  Red Hat Customer Support can be contacted via the Red Hat Customer Portal at the following URL:

https://access.redhat.com