If you are using PHP hopefully you are running on Linux which means you probably won’t have the unfortunate task of having to connect to MS SQL Server. Although rare, there may come a time where you need to integrate with an outside system that uses a SQL Server database and no other options for getting data are viable (ie APIs).

This post will outline how to set this up. In this case I was using Ubuntu 14.04 LTS 64 bit but the instructions should be pretty close to earlier versions or 32 bit. These are what worked for me on a clean Virtual Box installation then replicated on a remote server. It is possible some of the commands are redundant or not needed. Please comment if you find some. These instructions assume you already have the LAMP stack installed.

  1. Apt-Get Commands
    • sudo apt-get update
    • sudo apt-get install unixodbc tdsodbc php5-odbc freetds-dev unixodbc-dev freetds-bin
    • sudo apt-get update
    • sudo service apache2 restart
  2. /freetds/freetds.conf – Here you can declare multiple server parameters if you need to have multiple connections. In this case we are using the connection defined with ‘sqlsrv’
  3. /etc/odbcinst.ini
  4.  /etc/odbc.ini
  5. connect.php – PHP file to connect to database. This is just an example. You’d probably want to declare a database class and connect to the database as needed.

Categories: Uncategorized

Related Posts

Sugar Outfitters

Background Updater for SugarCRM Version 2

Background Updater for SugarCRM version 2 now available.


Dashboard Manager Now for SugarCRM 7

We have just updated our Dashboard Copy Manager to be compatible with SugarCRM 7 On-Demand. Dashboard Copy Manager allows admins to quickly copy Home, List View, and Record View dashboards to Users, Teams, and Roles. Read more…


Conditionally Disable Editing in SuiteCRM Based On Field Value

A common customization for SuiteCRM is controlling the user behavior while editing records. A couple of examples are forcing a field to be filled based another field value, updating a field based on the input Read more…