MS SQL Server Connections

From: Google Mike (googlemike_at_hotpop.com)
Date: 11/19/03


Date: 19 Nov 2003 13:50:45 -0800

I have Red Hat 9. Anyone here have that too and can help me?

Without having to do a lot of major surgery, such as recompiling my
PHP (which I consider risky), I want to use either unixODBC or FreeTDS
to connect RH9 Linux to MS SQL Server 2000.

I noticed from phpinfo() that FreeTDS wasn't configured into the PHP
install, although I have installed FreeTDS just now. That's probably
why the mssql_connect() call won't connect -- says Call to undefined
function. I probably need to recompile PHP (again, risky) in order to
get this to work. However, I *DID* notice that unixODBC was enabled,
so I wanted to connect with that using this code:

$dsn = "Driver={SQL Server};Server=10.22.109.5;Database=pubs";
$user = 'sa';
$pass = 'password';
$link = odbc_cconnect($dsn, $user, $pass);
$sql = 'SELECT * FROM authors';
$q = odbc_exec($link, $sql);
$rec = odbc_fetch_array($q);
echo $rec['au_lname'];
odbc_free_result($q);

Well, again, it says Call to undefined function odbc_connect().

What's the catch? Is there a simple way out of this?



Relevant Pages

  • HOWTO: FreeTDS for Newbies (almost complete)
    ... One way to do that is to install FreeTDS, recompile PHP, ... You can go to freetds.org and install the RPMs on Unix or Linux ...
    (comp.lang.php)
  • Re: php and freetds
    ... process of all my apache servers, everything turns ok, ... I just asked what his PHP question was. ... And if it is a FreeTDS problem, FreeTDS has its own mailing list where he can get much better help from the experts. ...
    (comp.lang.php)
  • Re: Any luck getting PHP/Linux to talk to MS SQL 2K?
    ... >> What does telnet sqlserverip 1433 do? ... I then read on the FreeTDS website how to use the command-line ... >command that comes with FreeTDS called tsql. ... >Anyone know how to recompile PHP 4.2.2 with this option? ...
    (comp.lang.php)
  • Re: MS SQL Server Connections
    ... >PHP, I want to use either unixODBC or FreeTDS ... But compiling is not risky at all. ... Jochen Daum - CANS Ltd. ...
    (comp.lang.php)
  • Adding PHP modules
    ... Is there a "smarter" way of adding PHP modules than recompiling entire PHP SRPM ... What I'm currently doing is taking PHP SRPM package, editing php.spec file, ...
    (Fedora)