Bug 483690 - PHP odbc with UnixODBC causes hang or Segfault when driver changes
PHP odbc with UnixODBC causes hang or Segfault when driver changes
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: php (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Joe Orton
Depends On:
  Show dependency treegraph
Reported: 2009-02-02 19:50 EST by Deron Jensen
Modified: 2010-03-30 04:24 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-03-30 04:24:43 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Deron Jensen 2009-02-02 19:50:51 EST
Description of problem:
The PHP odbc extension is linked with two libraries -lodbc and -lodbcpsql.  The -lodbcpsql is the 'default' Postgres odbc library installed with unixODBC.  This driver should not be used for PG.  There is actually no need that I can see to link in a specific ODBC driver.  It appears this is specific to the RPM build for php 5.2.6 (not PHP itself).  I found patch "php-5.2.4-odbc.patch" this adds the '-lodbcpsql' to the config.m4.  Then the php odbc extension will call the old libraries unexpectedly.  I also found various e-mail threads on the internet where users were having problems with LDAP with similar symptoms.
A workaround is to modify the spec file to NOT install this patch.

Version-Release number of selected component (if applicable):
php5.2.6 (odbc)

How reproducible:
run a php script with odbc_connect after changing to the new PG driver installed with Postgres.

Steps to Reproduce:
1.  Install php (from RPM), unixODBC, and PG 8.3
2.  Change odbc.ini to use new PG driver 'psqlodbc.so' (from postgresql-odbc)
3.  Run a php script that uses 'odbc_connect'
Actual results:
If compiled with thread support it will 'hang' forever.  If compiled without thread support it will cause a SEG Fault.

Expected results:
Database connection

Additional info:
It appears as though part of the odbc_connect uses the driver manager libraries (libodbc) and part uses the default libraries (libodbcpsql).  It should only call libodbc libraries, and use the driver manager to decide the DSN connection settings.  You can see both libraries using "ldd" on the php odbc extension (odbc.so)
$ ldd /usr/lib/php/modules/odbc.so
        linux-gate.so.1 =>  (0x0095d000)
        libodbc.so.1 => /usr/lib/libodbc.so.1 (0x00110000)
  (NOT NEEDED) libodbcpsql.so.2 => /usr/lib/libodbcpsql.so.2 (0x00690000)
Comment 1 Joe Orton 2009-02-26 04:26:58 EST
Thanks for the report and analysis.

I seem to recall the -lodbcpsql patch was added, way back when, because of undefined in libodbc; I guess that was a different bug.
Comment 2 RHEL Product and Program Management 2009-03-26 13:07:17 EDT
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release. If you would like
this request to be reviewed for the next minor release, ask your
support representative to set the next rhel-x.y flag to "?".
Comment 4 Joe Orton 2009-12-16 07:42:35 EST
I've made test packages available which should fix this issue.  These
packages are unsupported, have not been through the standard Red Hat
QA process, and are not recommended for use on production systems.


Use of these packages may prevent you from (automatically) upgrading
to any asynchronous security errata which are issued before the
release of RHEL 5.5 due to version mismatches.

Please record any feedback on use of these test packages (positive or
negative!) on this bug report.
Comment 7 Nick 2010-03-05 16:02:13 EST
This bug also applies to php 4.3.9 in RHEL4.  The patch "php-4.3.1-odbc.patch" in that build also adds '-lodbcpsql', and if you try to use the postgres driver, you get the same results described in this bug.

Opened bug 570922 to cover php 4.3.9 in RHEL4.
Comment 9 errata-xmlrpc 2010-03-30 04:24:43 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.