SQLServer

From DreamFactory
Jump to: navigation, search
(SQLSRV Installation)
Line 16: Line 16:
 
#** <source lang="bash">$ sudo pecl install pdo_sqlsrv-4.1.6.1</source>
 
#** <source lang="bash">$ sudo pecl install pdo_sqlsrv-4.1.6.1</source>
 
# Enable the extensions in PHP
 
# Enable the extensions in PHP
#* Edit `/opt/bitnami/php/etc/php.ini`
+
#* Edit <code>/opt/bitnami/php/etc/php.ini</code>
 
#* Add these lines:
 
#* Add these lines:
#** `extension=sqlsrv.so`
+
#** <code>extension=sqlsrv.so</code>
#** `extension=pdo_sqlsrv.so`
+
#** <code>extension=pdo_sqlsrv.so</code>
 
# Restart the Bitnami Stack
 
# Restart the Bitnami Stack
 
#* <source lang="bash">$ sudo /opt/bitnami/ctlscript.sh restart</source>
 
#* <source lang="bash">$ sudo /opt/bitnami/ctlscript.sh restart</source>

Revision as of 16:00, 30 June 2017

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-4.1.6.1
      • $ sudo pecl install pdo_sqlsrv-4.1.6.1
  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