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 sgottenyc on 08/06/07 22:39

On Aug 4, 7:30 pm, sgotte...@yahoo.com wrote:
> On Aug 4, 7:18 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>
>
>
>
>
> > sgotte...@yahoo.com wrote:
> > > On Aug 4, 6:51 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> > >> sgotte...@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.
> > >> jstuck...@attglobal.net
> > >> ==================- Hide quoted text -
>
> > >> - Show quoted text -
>
> > > Thanks for the reply Jerry.
> > > Do you mean using PHP sockets?
>
> > If your system is set up to use sockets, yes. But there could be a lot
> > of other ways to set it up, also - web pages on the IIS server and RPC
> > are two of them.
>
> > You need to find out how the admins set up this network before you can
> > get your code working.
>
> > --
> > ==================
> > Remove the "x" from my email address
> > Jerry Stuckle
> > JDS Computer Training Corp.
> > jstuck...@attglobal.net
> > ==================- Hide quoted text -
>
> > - Show quoted text -
>
> Thanks for the info,
> I will look into it.- Hide quoted text -
>
> - Show quoted text -

Hello again,
Could you help me with an example of how this could be done using the
technique mentioned above: web pages on the IIS Server.
Say, for instance, that my front end Apache Server has a page called
Employee.php that needs to display Employee data, like so:

$getEmployeeStmt = mssql_init("Sp_Get_EmployeeData");
mssql_bind($getEmployeeStmt, "@employeeNumber", $employeeNumber,
SQLVARCHAR, false);
$result = mssql_execute(getEmployeeStmt);
while($row = mssql_fetch_row($result))
echo "name: $row[0] <br />";

How could I use a web page sitting on the IIS server to get the
required information over to the Apache for this Employee.php page?
Thanks,
Simon

 

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

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