SQLServer-Ubuntu 16
From DreamFactory
There are two different drivers you can use to connect to Microsoft SQL. We highly recommend the sqlsrv driver over dblib/freetds. However dblib/freetds is still supported.
SQLSRV
Note: 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.
- Install the ODBC 13 Driver (only support on Ubuntu 15 and 16)
-
$ curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
-
$ sudo sh -c 'curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list'
-
$ sudo apt-get update
-
$ sudo ACCEPT_EULA=Y apt-get install msodbcsql unixodbc-dev
-
- Install tools used for PECL
-
$ sudo apt-get install php7.1-dev php-pear
-
- 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.3.0.
-
$ sudo pecl install sqlsrv
-
$ sudo pecl install pdo_sqlsrv
-
- sqlsrv on PECL is has been released from development to stable. As of the writing of these instructions, the latest verison 4.3.0.
- Create the ini files
-
$ sudo sh -c 'echo "extension=sqlsrv.so" > /etc/php/7.1/mods-available/sqlsrv.ini'
-
$ sudo sh -c 'echo "extension=pdo_sqlsrv.so" > /etc/php/7.1/mods-available/pdo_sqlsrv.ini'
-
- Enable the extensions in PHP
-
$ sudo phpenmod sqlsrv pdo_sqlsrv
-
- Restart the PHP-FPM and Nginx or Restart Apache (whichever solution you're using.)
- Nginx
-
$ sudo service php7.1-fpm restart && sudo service nginx restart
-
- Apache
-
$ sudo service apache2 restart
-
- Nginx
DBLIB/FreeTDS
- Install the module using Apt
-
$ sudo apt-get install php7.1-sybase
-
- Restart the PHP-FPM and Nginx or Restart Apache (whichever solution you're using.)
- Nginx
-
$ sudo service php7.1-fpm restart && sudo service nginx restart
-
- Apache
-
$ sudo service apache2 restart
-
- Nginx