1. Install FreeTDS. (./configure && make && make install)
  2. Install PHP with freetds support (./configure –with-sybase=DIR, where DIR is wherever you placed freetds usually /usr/local)
  3. Read a bit of /etc/freetds.conf (not mandatory)
  4. ini_set('mssql.secure_connection','On'); $con = mssql_connect ("", "user", "pass") or die ("Could not connect to SQL server"); //.mssql_get_last_message() mssql_select_db ("thedb", $con) or die ("Cannot open database"); $sql= "select top 10 * from test"; $rs= mssql_query ($sql, $con); while($line = mssql_fetch_row($rs)){ print "$line[0]<br>"; } mssql_close ($con); exit(0);

Using the MSSQL Server extension on Win32 requires these steps:
1) Install the SQL Server Client tools on the machine running PHP
(you can get that for free from Microsoft, the one you need is probably sqlncli.msi)
2) Configure a server alias using the client network utility. The alias specifies name, host name, protocol and port numbers used for the db communication
3) Connect to the database using the alias as db name as first parameter in mssql_connect
4) If the SQL Server is configured for trusted connections only, enable this in PHP.INI by setting mssql.secure_connection = On (no need for userid and password then)