MSSQL Connection Error with PHP

Written by Mike on February 28, 2009 – 10:15 pm -

mssql_connect() is a function which establishes a connection to a MS SQL server using PHP. To use MSSQL database in PHP page make sure that MSSQL dll is enabled in PHP. To check open php.ini file and search for following

extension=php_mssql.dll

Sometime it happens that when you try to connect MSSQL database using PHP it throws following Error (espiceally when you have installed PHP 5)

Warning:  mssql_connect() [function.mssql-connect]: Unable to connect to server:  SERVER\SQLEXPRESS in C:\Inetpub\wwwroot\dbconnection.php on line 6

The problem come due to higher version ntwdblib.dll available with PHP 5. The simple fix for this problem is to replace the ntwdblib.dll with old version. You can download the Old version of dll file from http://trulymanaged.com/downloads/ntwdblib.dll OR if you have Plesk Control Panel you can directly copy/replace C:\WINDOWS\system32\ntwdblib.dll with C:\Parallels\Plesk\additional\PleskPHP5\ntwdblib.dll


Tags: , , ,
Posted in Plesk For Windows, VPS hosting, Windows VPS | 1 Comment »

One Comment to “MSSQL Connection Error with PHP”

  1. software data recovery Says:

    Great information. It is very helpful and good post for all the person who are facing this error. Thanks for the solution.

Leave a Comment

RSS

  • Subscribe Me

  • Tag Cloud

  • Archives