[freetds] PHP and DSN-less Connection Strings

Daniel Fazekas fdsubs at axelero.hu
Fri Mar 18 04:57:34 EST 2005


On Mar 18, 2005, at 10:21, Jon Doblados wrote:

> Ah yes, I figured that much. I tried copying
> /usr/local/freetds/lib/libtdsodbc.so (from freetds FAQ) to
> /usr/lib/php/extensions only to find out that I don't have
> libtdsodbc.so, as I only see libtds.so.

Don't do that; you are confusing things.

In the php extensions folder you'll need PHP's odbc extension which on 
Linux should be called odbc.so. FreeTDS has nothing to do with it, it's 
built from the PHP source tree as part of the PHP compilation process 
or separately afterwards.

You'll most likely find that your Linux distribution offers a 
pre-compiled odbc extension for PHP, it's just not installed by 
default. It could be called php-odbc or something similar.

Then, you'll still have to solve the problem of not having that 
libtdsodbc file, too. That one is built as part of FreeTDS but only if 
the configure script can find a suitable ODBC driver manager and its 
header files.
You seem to fall into the usual scenario of having unixODBC installed 
but you miss its header files so the FreeTDS configure script didn't 
pick it up. So, you'll have to install those unixODBC headers then 
reconfigure and recompile FreeTDS. This too ought to be available in 
your Linux distribution by simply installing an optional package. In 
Red Hat terminology, it's called unixODBC-devel. I don't know much 
about SuSE.

By the way, when you are at the step of reinstalling FreeTDS, consider 
trying the 0.63 release candidate instead of 0.62.4.

> odbc_connect. I also noticed unixODBC on my server. Should freetds
> work in tandem with unixODBC or that's an entirely different game?

unixODBC provides the driver manager, FreeTDS provides the driver and 
PHP provides its ODBC extension.

The chain will basically look like this:
PHP -> unixODBC -> FreeTDS

One of the advantages of using the mssql/sybase/sybase_ct extensions 
with PHP is that it lets php access FreeTDS directly, leaving out the 
middle-man ODBC driver manager.

--
fds



More information about the FreeTDS mailing list