From DreamFactory
Jump to: navigation, search

There are two different drivers you can use to connect to Microsoft SQL. We recommend the sqlsrv driver over dblib/freetds. However dblib/freetds is still supported and is already installed with your Bitnami package.

Until recently, Microsoft did not support sqlsrv driver on linux, however this has recently changed. The most recent versions of the Bitnami stack (built on Debian 8) do support installing this driver.

SQLSRV Installation

Note 1: These instructions were adapted from the official Microsoft PHP SQLSRV repo on Github[1]. Please consult this repo for additional information about this driver and its implementation options.
Note 2: For Bitnami VMs, this is only support on 2.7.0 and higher, using the Debian 8 build.

  1. Install the ODBC 13 Driver (only support on Ubuntu 15 and 16)
    • $ sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/microsoft-debian-jessie-prod/ jessie main" > /etc/apt/sources.list.d/mssql.list'
    • $ sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
    • $ sudo apt-get update
    • $ sudo apt-get install msodbcsql unixodbc-dev
  2. Install sqlsrv and pdo_sqlsr using PECL
    • sqlsrv on PECL is has been released from development to stable. As of the writing of these instructions, the latest verison 4.0.8.
      • $ sudo pecl install sqlsrv-
      • $ sudo pecl install pdo_sqlsrv-
  3. Enable the extensions in PHP
    • Edit /opt/bitnami/php/etc/php.ini
    • Add these lines:
      • extension=sqlsrv.so
      • extension=pdo_sqlsrv.so
  4. Restart the Bitnami Stack
    • $ sudo /opt/bitnami/ctlscript.sh restart