UPDATE (March 23rd 2012):
I recently found a PHP binary that has a one-line installer. It is actively maintained by Liip AG. I now use that in combination with HomeBrew for all the rest. The Liip package is compiled with pdo_dblib which makes the problem described in this post a non-issue.
I recently found myself in the position of having to connect to a remote Microsoft SQL Server from my OSX system using PHP. The production environment runs Ubuntu LINUX, where connecting via mssql_connect() was no problem, but I develop on OSX and I could not get this to work initially.
mssql_connect() simply returns boolean FALSE on failure and PHP tells you little more than
1
|
|
It took quite a few hours to finally figure out that I could turn on some additional logging on the driver level. I use XAMPP and its PHP distribution uses FreeTDS for mssql access. There is a configuration file for this driver located at
1
|
|
that lets you turn on debug logging to a file.
Uncomment the following lines
1 2 |
|
And then run your connection attempt again. Take a look at the log for details on the failure.
In the end I added a new entry for an MS SQL server at the end of the freetds.conf file and used its name in the call to mssql_connect().
1 2 3 4 5 |
|
In my case I had to deal with an instance name that would normally be appended to the host name in a connection string, but for this driver configuration you have to use a variable called instance.
In PHP I then use this code during development
1
|
|