Sometimes you might wonder why you are not able to connect from PHP script with your MSSQL database as you have enabled php_mssql.dll extension from your php.ini.
Below are the step to resolve this issue;
But before we given the solution, you might get the following error message, however the error might just unable to connect to the MSSQL database without any further detail.
Assume you were using IIS6/7 with PHP 5.2.x(Microsoft Windows Server 2003/2008), you might get such issue if you are install the PHP with source installation.
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: localhost:1433 in C:\Domains\wwwroot\php_mssql.php on line 5
Couldn’t connect to SQL Server on localhost:1433
1. Download file ntwdblib.dll from URL of http://www.dlldll.com/ntwdblib.dll_download.html.
2. Go to the server hosted for your PHP script.
3. Go to PHP directory, assume you are using C:\Program Files\PHP5.2.x\, backup original ntwdblib.dll.
4. Replace the file as downloaded from Step 1.
Test again, and your problem should resolved.
You may refer to the URL as below for more information on the PHP_MSSQL connect page available from PHP.Net