PHP does not connect to MSSQL 2005 (but mssql_connect works)

Error:
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: NOMADS_TOSHIBA\MSSQL2005 in C:\WebServers\home\localhost\www\salarymanager\includes\system\db.inc.php on line 20

Solution:

Download file: how_to_make_PHP_work_with_MSSQL.rar (couldn’t upload file here, please email me, I will send them)

Microsoft SQL Server 2005 and Vista.

The following steps enabled MSSQL 2005 support on Vista Home Permium.
(native drivers, not odbc which works out-of-the-box)

1) Place ntwdblib.dll in C:\Windows\System32
2) Place php_mssql.dll in C:\Windows\System32
(I gave IUSR full access to these files, maybe read is enough)

3) uncomment php_mssql.dll in php.ini

4) Changed my default SQLSERVER 2005 install so it accepts named pipes.
start -> Sql server surface area configuration ->
surface area configuration for services and connections->
MSSQLXXX-> database engine -> remote connections -> using both TCP/IP and named pipes

5) reboot.

After that I could use the mssql_* functions.

Hope that helps. I guess same applies to Windows 7

Leave a comment