I have a number of servers running PHP 5.2.6 (non-thread-safe build) on Windows 2003/IIS6 utilising FastCGI.
I'm having some issues connecting to MS SQL 2000/2005 (MySQL connectivity is working fine, ASP/ASP.NET scripts can connect to MS SQL successfully as well). One solution suggests copying the SQL Client Tools ntwdblib.dll
file to the PHP extensions folder or installing all of the SQL Client Tools on the web server (which I'm reluctant to do).
Another solution suggested is to use the Microsoft SQL Server 2005 Driver for PHP. This looks fine for writing greenfield apps but for applications such as phpBBS or WordPress this doesn't appear to work.
For example, the following script:
<?php
$host = "mssqlhost";
$user = "phpbb2";
$password = "phpbb2";
$connect_sql_server = mssql_connect($host, $user, $password);
?>
Fails with:
PHP Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: mssqlhost in E:\AppsDev.NET_UK_Minds\phpSqlNC\www\test.php on line 6
The goal is to allow PHP scripts to connect to both SQL 2000 and SQL 2005 which are running on different servers. I should also add that upgrading to a later version of PHP isn't an option at this time.
What is the correct way to configure PHP on Windows 2003/IIS6 to connect to SQL 2000/2005?