Skip to Content.
Sympa Menu

freetds - RE: [freetds] Compiling for PHP extension error

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: <ml AT freetds.org>
  • Cc:
  • Subject: RE: [freetds] Compiling for PHP extension error
  • Date: Fri, 8 Apr 2005 12:23:49 -0400

> From: jleelim online
> Sent: Friday, April 08, 2005 10:50 AM
>
> I need to install PHP Sybase support for Fedora Core 3. It has to be
Sybase
> because the Mssql library functions are not compatible with legacy
codes. I
> keep getting this Apache error when loading my sybase.so extension:
>
> "PHP Warning: Unknown(): Unable to load dynamic library
> '/usr/lib/php4/sybase.so' - /usr/lib/php4/sybase.so: undefined symbol:

> dbversion in Unknown on line 0"
>
> I first installed freetds-0.63:
>
> >./configure --with-tdsver=4.2
> >make
> >make install

Don't use 4.2 unless you have good reason. Use 5.0 for Sybase servers
and 7.0/8.0 for Microsoft. But that's not your problem. ;-)

> >SYBASE=/usr/local/freetds
> >LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$SYBASE/lib
> >export SYBASE LD_LIBRARY_PATH

This doesn't conform to your FreeTDS configuration. FreeTDS is
installed in /usr/local by default. Either use
--prefix=/usr/local/freetds when you configure FreeTDS, or set your
SYBASE variable to /usr/local.

> After I tried to compile PHP 4.3.9 sybase extension from php-src
package:
>
> >phpize
> >./configure --with-php-configure=/usr/bin/-php-config
> >--with-sybase=/usr/local/freetds
> >make
> >make install

Similarly, I think you want --with-sybase=/usr/local.

> My Apache is running httpd-2.0.52-3 and my Linux kernel is
2.6.9-1.667. Is
> this problem related to FreeTDS or PHP?

PHP. I think PHP's 'sybase.so' is failing to load the FreeTDS libsybdb,
because it's being told to look in the wrong place.

You can confirm that with GNU readelf(1), from the bintools package.
For example:

$ readelf -d build/src/odbc/.libs/libtdsodbc.so.0.0 |head

Dynamic segment at offset 0x44ccc contains 19 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library:
[libodbcinst.so.1]
0x00000001 (NEEDED) Shared library: [libc.so.12]
0x0000000e (SONAME) Library soname:
[libtdsodbc.so.0]
0x0000000f (RPATH) Library rpath: [/usr/local/lib]
0x0000000c (INIT) 0x65ac
0x0000000d (FINI) 0x34cc4

'readelf -d' shows you which dynamic libraries any ELF object uses, and
where it looks (without the aid of LD_LIBRARY_PATH). In this case
libtdsodbc.so.0 needs libodbcinst.so.1 and libc.so.12, and looks for it
in /usr/local/lib. My guess is that your sybase.so needs libsybdb.so.5
and looking for it where it ain't, in /usr/local/freetds.

HTH.

--jkl


-----------------------------------------
The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named
above. If you are not the intended recipient, or an employee or agent
responsible
for delivering this message to the intended recipient, any review,
dissemination,
distribution or duplication of this communication is strictly prohibited. If
you are
not the intended recipient, please contact the sender immediately by reply
e-mail
and destroy all copies of the original message. Please note that we do not
accept
account orders and/or instructions by e-mail, and therefore will not be
responsible
for carrying out such orders and/or instructions. If you, as the intended
recipient
of this message, the purpose of which is to inform and update our clients,
prospects
and consultants of developments relating to our services and products, would
not
like to receive further e-mail correspondence from the sender, please "reply"
to the
sender indicating your wishes. In the U.S.: 1345 Avenue of the Americas, New
York,
NY 10105.




Archive powered by MHonArc 2.6.24.

Top of Page