FreeTDS is a set of libraries for Unix and Linux that allows your programs to natively talk to Microsoft SQL Server and Sybase databases.
This bundle needs the FreeTDS
and pdo_dblib
driver to be installed on your system.
Simply install the correct packages:
sudo apt-get -y install php56-sybase php56-odbc tdsodbc
The simplest way to install dblib on OS X is by using Homebrew. This guide will therefore assume that you have Homebrew installed, are using PHP installed with Homebrew and using the native Apache server in OS X.
brew update
brew install php56-pdo-dblib
The installation can take some time, be patient!
Note
Any version of PHP installed should work. Just change php56
in the command to match your version og PHP.
Restart your webserver and verify with phpinfo();
if pdo_dblib
is properly installed.
To finish up we also need to do some modifications to the FreeTDS configuration.
You can probably find the config file in /usr/freetds/freetds.conf or /usr/local/etc/freetds.conf. pen it with your favorite text editor.
In the [global]
section, find a line that looks like
; tds version = x
Uncomment the line and change the version number to 8.0, you should have
tds version = 8.0
Then also add the following line below the version
client charset = UTF-8
Save the changes and you are good to go.
Note
Although you would expect this to be enough for UTF-8 to be supported it isn't, that's why you still need this bundle to make it work.
When your FreeTDS config is used by multiple apps and you can not change the global settings you can create a separate group instead
[example]
host = <host_or_ip_of_db_server>
tds version = 8.0
client charset = UTF-8
Then when you specifiy the host in your Symfony parameters.yml you will use "example" instead of the host/ip and this block with it's configuration will be used instead