Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Ok this is going to be somewhat involved.

I have three servers: First I have a box running Linux with Apache and PHP 5.2.17. We shall call this "LB" for Linux Box. Second I have a Server Running Windows Server 2008 R2 with MS SQL Server 2008. We shall call this server "DB" Lastly I have a Server Running Windows 7 with IIS 7.5 and PHP 5.2.9. This shall bee known as "WB" for Windows Box.

The Situation: My company has a multitude of web applications that are written in PHP running on LB. These connect to DB via the php_mssql.dll driver. These applications run flawlessly on LB.

Unfortunately the person that created LB did not document the server's creation and no one in our company is Linux savvy enough to maintain LB or rebuild it should it have a major hardware failure. Being as there are seriously mission critical applications that run on this server the decision was made to migrate to a Windows System running IIS.

Enter WB. WB is intended to be a temporary solution for reasons that are not applicable here, but this is the reason it is a Windows 7 system and not a full blown Server.

So on WB I installed IIS and PHP 5.2.9 as that is the lastest version of PHP to support the php_mssql driver. I am also running a separate version of php for a different site on this box.

I have verified that the PHP installs are working. I copied the files from LB to WB directly for the PHP application pages.

When I attempt to run the pages on WB from IIS I get an error stating "Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: ..."

This indicates that the driver is functioning but I am not able to connect to DB...

with the mssql_connect I am using DB's IP address in all instances.

Now as I said this code runs flawlessly on LB on Apache.

So I grabbed Uniform Server, a portable WAMP Stack, and installed PHP 5.2.9 on it and ran it on WB. I again copied the code from LB to the Uniform Server's docroot and the pages connect to DB without error.

From this I can determine that the php Driver can communicate with the Database. I can also assume that this is being caused because of how IIS is attempting to connect to DB. When I use the PHP ODBC Drive on the other PHP installation/site, using a DSN connection, it functions without error.

For some reason when I use an IP connection, which is the same type of connection that LB uses, to connect from WB to DB the connection is refused.

Notes: I have TCP/IP enabled on MS SQL Server. As the both Apache servers, on LB and in Uniform Server, can connect with an IP connection.

Modification of the php code for the web applications is not an option. I do not have the time to modify these pages as there are simply too many of them.

Changing to the new php_sqlsrv.dll Native MS driver is not an option as per above.

I can't use Uniform Server as a solution as part of this build is related to the issue we are having with our main Web Server.

I am at a loss. I have searched High and low. I have tried to replace the ntwdblib.dll for PHP. Did not work. There seams to be a difference in how Apache and IIS attempt to connect to DB with an IP connection.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.