PHP MSSQL 2005 Problem – Solved

Trying to make a connection to a MS SQL Server 2005 database from PHP, I always got an error message using the mssql_connect saying:

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

I tried several solutions like, updating the ntwdblib.dll (on windows; I had the same error on linux) library, configuring the tcp/ip properties on sqlexpress but nothing I still having the same error.

At the end I changed the ip address on the server name by the respective server name and finally worked!.

So instead of:


$server = 192.168.50.1;
$user = 'sa';
$password = 'sapassword';
$conn = mssql_connect($server, $user, $password);

Changed for:

$server = cmanonserver;

This entry was posted in linux, programming, uncategorized and tagged , , , , by cmanon. Bookmark the permalink.

About cmanon

Gracias por visitar mi pagina personal. Soy una persona que le apasionan las computadoras, uso linux, me gusta la fotografia y algunas cosas de programacion que podran encontrar aqui en el sitio. Thank you for visiting my page, I’m a computer enthusiast that like linux, photography and more stuff that you’ll find here in my webpage.