Skip to Content.
Sympa Menu

freetds - apache/php/unixODBC/freetds problem

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Bj�rn Lantz" <bjorn.lantz AT twoguysandadog.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: apache/php/unixODBC/freetds problem
  • Date: Mon, 7 Oct 2002 03:45:26 -0400


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





  • apache/php/unixODBC/freetds problem, Björn Lantz, 10/07/2002

Archive powered by MHonArc 2.6.24.

Top of Page