|
Posted by sgottenyc on 08/04/07 18:44
Hello,
If you could assist me with the following situation, I would be very
grateful.
In my current position, we have to use a non-traditional server setup
to serve PHP-generated web pages.
Instead of the classic web server->database server setup, what they
have at my workplace instead is:
Apache on a frontend server -> needing to connect to IIS on a backend
server -> needing to connect to SQL Server on the same backend
server. This setup was used, according to my understanding, for
security reasons.
Throughout my PHP scripts, I use connection code similar to the
following, which has worked fine for me on a
web server->database server test system:
$myServer = "testservername";
$myUser = "testuser";
$myPass = "testuserspassword";
$myDB = "dbName";
$conn = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to Server.");
mssql_select_db($myDB, $conn)
or die("Couldn't connect to Server database.");
I have changed this code to something like the following for the
production system:
$myServer = "backendservername";
$myUser = "testuser";
$myPass = "testuserspassword";
$myDB = "dbName";
$conn = mssql_connect($myServer, $myUser, $myPass)
or die("Could not connect to Server.");
mssql_select_db($myDB, $conn)
or die("Couldn't connect to server database.");
The problem is that we are receiving the "Could not connect to Server"
error. I.e., Apache is not switching over the processing of the PHP
page to the IIS server once the '$myServer = "backendservername";'
code is encountered. (Both the IIS and Apache have the same PHP codes
in their respective directories.)
My questions:
1) Is this sort of setup workable? Has anyone successfully used a
similar setup to this in the past?
2) If so, how to do it? Can Apache be instructed to switch over
processing of PHP pages to the IIS on the other server via some sort
of Apache command? Is it instead some sort of programming issue that
I can fix by tweaking my code?
Thanks again for your assistance. I very much appreciate it,
Simon Gottesman
[Back to original message]
|