Installing php with odbc on a Linux box
Posted on 2006-06-28
I'm a complete Windows junkie, and I think I'm making this process harder than it really is... Anyways, here goes:
I need to connect to a MSSQL server from a Linux box (Fedora Core 5) using PHP. I already installed freeTDS and configured a DSN, at least that's what I think I did, because I'm able to run a query from the command line using isql. This is the command that I use to do so:
isql -v MSSQLTestServer "user" "pass"
After running this command I immediately get a SQL> prompt.
Now my problem is accessing the MSSQL server using php... I read in the freeTDS user guide that I needed to configure PHP using ./configure --with-iodbc=/usr/local, but I got errors on each odbc command. I then changed the configuration to ./configure --with-unixodbc=/usr/local, I got no errors during the make and make install process, but I still can't connect. If I need to install something, please give me details, most of the web pages out there that give instructions are oriented to Linux users. I know nothing about rpms, yums, configure code, etc. I am reading though, I know there's a lot to learn with a new OS! This is the code that I'm using:
$connect = odbc_connect("MSSQLTestServer","user","pass");
if (!$connect) die ("Invalid connection");
As you guessed it, everytime I open the page I get "Invalid connection". I appreciate any help. Thanks!