I\'m trying to connect to an MSSQL database with PHP and encounter a very frustrating error while trying to connect. It loads for a minute, before printing out the following mes
My install process actually worked, but the connection was indeed invalid. I should have been using the IP address as the host name, which I was not. I was also using a colon instead of a comma before the port number. Finally, no spaces can be allowed in the connection string, which I thought would be automatically stripped out. So, here's a valid connection string for those of you that may find yourself in a similar predicament:
$connectionString="sqlsrv:Server=123.123.12.1,9864;Database=mssqldatabaseWootWoot";
Also, in response to my earlier observation about that function sqlsrv_connect, I had not enabled the driver necessary for that function. It is located in php_sqlsrv_54_ts.dll, which after enabling, reported the function as existing.
Thanks to anyone who put any time into solving this.
I ran into the same problem but I found that I did not need to use the IP address, the server name worked just fime. Also I was not sure what port my server was using, I found the information here: How to find the port for MS SQL Server 2008?
I also found the following links helpful in getting PDO to work:
PHP PDO Connection to SQL Server with integrated security?
Use of PDO in classes
MS SQL Server (PDO) — Microsoft SQL Server Functions (PDO_SQLSRV)
I know ncksllvn solved his problem so I hope this helps whoever else visits!