Ubuntu – Install PHP MSSQL drivers in Ubuntu

PHPsql serverUbuntu

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

Best Answer

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.

php5-sybase

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