Pacha
Pacha

Reputation: 1526

Can't connect to MSSQL from PHP

I have been trying to connect to my SQL server from my web host using the built-in PHP functions, but no luck so far.

This is my code:

mssql_connect("201.252.95.27:1433/SQLEXPRESS", $sqlServerUsername, $sqlServerpassword);

And this is the error:

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

Tried using "201.252.95.27", "201.252.95.27:1433", "201.252.95.27,1433", "201.252.95.27:1433/SQLEXPRESS" and all possible combinations, but it isn't working.

The server is running and the port is open.

Upvotes: 0

Views: 235

Answers (1)

akatakritos
akatakritos

Reputation: 9858

SQL Server usually uses a comma to separate the port, and a backslash to separate the instance name.

Using 201.252.95.27,1433\SQLEXPRESS I was able to connect to your server, but lacking a username/password, I couldnt log in.

Upvotes: 1

Related Questions