Although the libraries to work with Microsoft SQL Server used to be included with PHP, this is no longer the case. If you are using an IIS server, Microsoft has been gracious enough to provide drivers that use the native SQL client called SqlSrv; however, Linux users do not have access to this driver. To work with SQL Server 2008 on linux, you will need to install the FreeTDS libraries.

Installation and Configuration of FreeTDS

Note: You will need sudo access to do this procedure

  1. Install the Sysbase library for PHP (FreeTDS is provided with this)
    sudo apt-get install php5-sybase
  2.  Configure the freetds.conf file to use version 8.0 (this is necessary to work with MSSQL 2008, if you do not do this you will encounter odd behavior)
    sudo vim /etc/freetds/freetds.conf
  3. Change this line under the [global] section
    ;       tds version = 4.2

    to

    tds version = 8.0
  4. Restart Apahce
    sudo /etc/init.d/apache2 restart