Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
CodeIgnitor/PHP mssql with freetds and Homebrew

Make sure you installed Hombrew PHP with --with-mssql

You can check using a command like below: /usr/local/opt/php53/bin/php -i | grep Configure

When I pointed my apache to the homebrew version of php, it was already configured to have the mssql and freetds libraries working, otherwise you may have to add the .so file in the freetds directory to your php.ini file

Then I just had to something like this to my freetds.conf:

host =
port = 5433
client charset = UTF-8
tds version = 8.0

and configure codeignitor database.php

$db['default']['hostname'] = 'my_mssql_server';
$db['default']['username'] = 'sql_server_user';
$db['default']['password'] = 'sql_server_userpass';
$db['default']['database'] = 'SomeDbName';
$db['default']['dbdriver'] = 'mssql';



This comment has been minimized.

Copy link
Owner Author

callado4 commented Jun 13, 2013

To get it working on ubuntu, this was the last command I used to get it working (there were other packages installed before with may have helped)

sudo apt-get install libsybdb5 freetds-common php5-sybase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.