Quantcast
Channel: Microsoft Drivers for PHP for SQL Server forum
Viewing all articles
Browse latest Browse all 391

Cannot connect PHP 5.2.9 to SQL Server 2008

$
0
0
Hello,

I have a strange problem while connecting to MSSQL 2008 with php.
First I wrote the code myself and I got error message:

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: 172.16.2.12:1433 in C:\xampp\htdocs\test.php on line 19
After googleing for a few hours I found out that with the 2005 version there is some problems with ntwdblib.dll but I cannot find any bugs/problems for this with php 5.2.9 and SQL 2008.

Then I used the code from the Microsoft site:

<?php
// Server in the this format: <computer>\<instance name> or 
// <server>,<port> when using a non default port number
$server = '172.16.2.12,1433';

$link = mssql_connect($server, 'Username', 'Password');

if(!$link)
{
    die('Something went wrong while connecting to MSSQL');
}
?>
But still I get the error:
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: 172.16.2.12:1433 in C:\xampp\htdocs\test.php on line 19

Yes: The port is 1433;
Yes: The port is open;
Yes: I can connect with telnet;
Yes: The username is correct;
Yes: Also is the password.

Apache server is running local on my workstation.
SQL 2008 is running on remote server (172.17.2.12).

I have no idea what the problem is, and I am sure that the code is correct.

Someone any ideas what this might be?

Thanks in advance;

Lucas Mateijsen

Viewing all articles
Browse latest Browse all 391

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>