Trouble connecting to remote SQL server

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
Swede78
Forum Contributor
Posts: 198
Joined: Wed Mar 12, 2003 12:52 pm
Location: IL

Trouble connecting to remote SQL server

Post by Swede78 »

I cannot seem to connect to a remote MS SQL server. I have my php.ini configured to support mssql. I found on php.net that this may be my problem:
Just a little comment that I would like to add:

If you intend to access MS SQL server remotely, you need to install SQL Server Client Tools on the system which hosts your PHP code.
Does anyone know where I can get SQL Server Client Tools, and if it's free? Maybe that's a stupid question, seeing that it is Micro$oft. But, I can't even find this at microsoft.com. I assume they would have it, but I could be wrong.

Here is my connection code:

Code: Select all

<?php
$hostname_connPSUser = "********.com";
$database_connPSUser = "Database";
$username_connPSUser = "Username";
$password_connPSUser = "Password";
$connPSUser = mssql_connect($hostname_connPSUser, $username_connPSUser, $password_connPSUser) or die("Couldn't connect to SQL Server on $hostname_connPSUser");
?>
And here is the error in my log:
PHP Warning: mssql_connect() [<a href='http://www.php.net/function.mssql-conne ... connect</a>]: Unable to connect to server: *******.com in C:\Inetpub\*****.php on line 71

Any suggestions would be greatly appreciated.
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post by microthick »

You can download the demo for MS SQL Server:
http://www.microsoft.com/downloads/deta ... layLang=en

The server stops working after a while, but the client tools will always work.
Swede78
Forum Contributor
Posts: 198
Joined: Wed Mar 12, 2003 12:52 pm
Location: IL

Post by Swede78 »

Thank you, I'll give it a try.
Post Reply