You are here: Re: IIS and Apache to serve one PHP page? « PHP Programming Language « IT news, forums, messages
Re: IIS and Apache to serve one PHP page?

Posted by Jerry Stuckle on 08/04/07 23:51

sgottenyc@yahoo.com wrote:
> 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
>

THe only way processing will switch to the IIS server is if you load a
page containing PHP code on the IIS server or otherwise specifically
call PHP code on that other server. For that you need to be using
networking functions. Exactly which ones depend on your setup, and
every one is different.

Just setting a variable doesn't do a thing - other than set the variable.

And your connection is trying to connect to the mssql server at
"backendserver", not execute PHP code on that server.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация