Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How do I install MS SQL drivers for PHP on Ubuntu.

share|improve this question

1 Answer 1

There is no support for mssql directly under Ubuntu. There are a couple options.

I believe you can get some functionality by using the sybase module.


Package: php5-sybase
Priority: optional
Source: php5
Description: Sybase / MS SQL Server module for php5
 This package provides a module for Sybase and Microsoft SQL Server
 database connections directly from PHP scripts. It also includes the
 pdo_dblib module for use with the PHP Data Object extension.

Another option would be to access the server via odbc. Install php5-odbc and tdsodbc.

The mssql extension that is part of PHP will only function when PHP is built on Windows. http://www.php.net/manual/en/intro.mssql.php

There is another driver/extension from Microsoft that supports PHP, but appears to only be functional on Windows. http://www.codeplex.com/SQLSRVPHP

share|improve this answer
Why Ubuntu does not ship with the MSSQL driver, you can compile it on linux. It uses the FreeTDS driver as opposed to the Sql Server 2000 native driver. –  Justin Dearing Mar 8 '12 at 1:01
You should add your own answer with a description to how to do this, and links to the source. –  Zoredache Mar 8 '12 at 1:11
Agreed, I will add a full answer when time permits. For now, look at the requirements page for proof that it works on linux. –  Justin Dearing Mar 8 '12 at 14:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.