MS SQL Server and PHP

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
nejolley
Forum Newbie
Posts: 4
Joined: Tue Jun 06, 2006 5:21 pm

MS SQL Server and PHP

Post 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.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Ensure you are using the correct hostname and port?
nejolley
Forum Newbie
Posts: 4
Joined: Tue Jun 06, 2006 5:21 pm

RE: MS SQL and PHP

Post 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))
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post 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.
nejolley
Forum Newbie
Posts: 4
Joined: Tue Jun 06, 2006 5:21 pm

Post by nejolley »

I host the site myself.
Post Reply