[freetds] Re: PHP & FreeTDS

Walls Rob W Contr 75 CS/SCBS Rob.Walls at HILL.af.mil
Tue Aug 24 19:09:16 EDT 2004

I used /usr instead of /usr/lib and followed the file at
http://www.unixodbc.org/doc/FreeTDS.html. Once I cleaned up all the other
files from botched installs and paid attention to where files were being
installed, and used odbcinst directly, isql started working using a user DSN
to a MS SQL server! This is great, but PHP still can't see the data source.
The ODBCConfig GUI tool gives errors, too. "Could not construct a property
list for (TDS)", which is the name of the driver I installed. I don't know
if that is at all related to the next problem.

I know this is not a PHP group, but I hoping someone knows what to do to
make this work with PHP without recompiling. Isql works fine with a user
dsn. I made a system DSN using odbcinst that was identical to the user DSN,
but odbc through that DSN with PHP doesn't work. I get a

Warning: SQL error: [unixODBC][FreeTDS][SQL Server]Unable to connect to data
source, SQL state S1000 in SQLConnect in /usr/share/php/common.inc on line

I'm using this code to connect:

$connection_string =
$connection = odbc_connect( $connection_string, $DB_LOGIN, $DB_PASSWORD); 

PHP finds an odbc.ini file in /etc/php.d/ which loads /usr/lib/php4/odbc.so
as an extension. So, shouldn't PHP be able to use a DSN just like isql? Is
the connect string I'm using bad?

Rob Walls 
Hill AFB, UT 84056 
PH (801) 777-2230 
DSN 777-2230 

-----Original Message-----
From: freetds-bounces at lists.ibiblio.org
[mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of James K. Lowden
Sent: Tuesday, August 24, 2004 3:20 AM
To: FreeTDS Development Group
Subject: Re: [freetds] Re: PHP & FreeTDS

On Mon, 23 Aug 2004 13:15:30 -0600, Walls Rob W Contr 75 CS/SCBS
<Rob.Walls at HILL.af.mil> wrote:
> I got the unixODBC dev rpm and used
> ./configure --with-tdsver=7.0 --with-unixodbc=/usr/lib (RedHat's 
> unixODBC RPM puts .so files in /usr/lib and puts .h files in
> /usr/include)

Close, but no cigar.  :-)  Try:

./configure --with-tdsver=7.0 --with-unixodbc=/usr

You're not directing the linker to the libraries.  You're directing the
whole build to the unixODBC files, both headers and libraries.  The
configure script assumes there will be lib/ and include/ relative paths
beneath whatever you pass to --with-unixodbc.


FreeTDS mailing list
FreeTDS at lists.ibiblio.org

More information about the FreeTDS mailing list