apache/php/unixODBC/freetds problem

Björn Lantz bjorn.lantz at twoguysandadog.com
Mon Oct 7 04:45:26 EDT 2002


Hi all,

I was writing a problem report, and while writing I found a solution for
the problem. I will supply the original text anyway as I think it might
help somebody using the same configuration.

The problem was connecting to a MSSQL 2000 server in php:
$db  = odbc_connect( "mydsn", "user", "pass", SQL_CUR_USE_IF_NEEDED );

works if changed to:
$db  = odbc_connect( "mydsn", "user", "pass" );

My original text:

I am having trouble with PHP-4.2.3/unixODBC-2.2.3/freetds-0.60 (and the
current one since a couple of days ago). I am not shure this is a freetds
issue.

The unixODBC library seems to try to load libodbccr.so.1 from /lib, but I
have all other libs in /usr/lib. If I put a copy of libodbccr.so.1 in /lib
it works 30-50% of the times, the others apache segfaults:
[Mon Oct  7 09:12:41 2002] [notice] child pid 5215 exit signal
Segmentation fault (11)

If I request a php script that uses odbc/freetds and don't have
libodbccr.so.1 in /lib it fails every time. I am not very good at
debugging under Linux, but I go the following output from an "strace
/usr/sbin/httpd -X -DHAVE_PHP4":

...
write(9, "SQLGetFunctions: fFunction is 52"..., 33) = 33
write(9, "SQLGetFunctions: fFunction is 53"..., 33) = 33
write(9, "SQLGetFunctions: fFunction is 70"..., 33) = 33
write(9, "SQLGetFunctions: fFunction is 54"..., 33) = 33
write(9, "SQLGetFunctions: fFunction is 23"..., 33) = 33
write(9, "odbc:SQLGetInfo: info option 8 n"..., 45) = 45
access("/lib/libodbccr.so.1", R_OK)     = -1 ENOENT (No such file or
directory)
open("/lib/libodbccr.so.1", O_RDONLY)   = -1 ENOENT (No such file or
directory)

the corresponding /tmp/freetds.log
...
SQLGetFunctions: fFunction is 52
SQLGetFunctions: fFunction is 53
SQLGetFunctions: fFunction is 70
SQLGetFunctions: fFunction is 54
SQLGetFunctions: fFunction is 23
odbc:SQLGetInfo: info option 8 not supported

php is build using --with-unixODBC=/opt/unixODBC-2.2.3 (where I have
untar:ed the unixODBC source package)

unixODBC ./configured with:
./configure \
        i386-redhat-linux \
        --prefix=/usr \
        --exec-prefix=/usr \
        --bindir=/usr/bin \
        --sbindir=/usr/sbin \
        --sysconfdir=/etc \
        --datadir=/usr/share \
        --includedir=/usr/include \
        --libdir=/usr/lib \
        --libexecdir=/usr/libexec \
        --localstatedir=/var \
        --sharedstatedir=/usr/com \
        --mandir=/usr/share/man \
        --infodir=/usr/share/info \
        --prefix=/usr \
        --with-config-file-path=/etc \
        --with-exec-dir=/usr/bin \
        --enable-threads=no


freetds ./configure:d with:
        i386-redhat-linux \
        --prefix=/usr \
        --exec-prefix=/usr \
        --bindir=/usr/bin \
        --sbindir=/usr/sbin \
        --sysconfdir=/etc \
        --datadir=/usr/share \
        --includedir=/usr/include \
        --libdir=/usr/lib \
        --libexecdir=/usr/libexec \
        --localstatedir=/var \
        --sharedstatedir=/usr/com \
        --mandir=/usr/share/man \
        --infodir=/usr/share/info \
        --prefix=/usr \
        --with-config-file-path=/etc \
        --with-exec-dir=/usr/bin \
        --with-unixodbc=/usr \
        --includedir=/usr/include \
        --oldincludedir=/usr/include \
        --with-tdsver=7.0

 



More information about the FreeTDS mailing list