Page 1 of 1

MS SQL Server and PHP

Posted: Fri Feb 16, 2007 4:31 pm
by nejolley
I'm trying to use PHP with an Microsoft SQL Database but keep getting the following error:

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server

I've included extension=php_mssql.dll in php.ini, and have SQL components installed on the web server. Does anybody know what else I need to be doing? I'm all out of ideas.

Posted: Fri Feb 16, 2007 4:38 pm
by superdezign
Ensure you are using the correct hostname and port?

RE: MS SQL and PHP

Posted: Fri Feb 16, 2007 4:55 pm
by nejolley
I'm pretty sure that information is correct. I've tried different variations of the following including different users etc.

$server = "xxx.x.xx.x:1433";
$user = "sa";
$pword = "pass";

$conn = mssql_connect($server, $user, $pword))

Posted: Fri Feb 16, 2007 5:21 pm
by superdezign
Well for it to not be connecting the server, there's probably an error in your servername. Maybe you should double-check with your host.

Posted: Fri Feb 16, 2007 5:24 pm
by nejolley
I host the site myself.