Re: IIS and Apache to serve one PHP page?



sgottenyc@xxxxxxxxx wrote:
On Aug 4, 7:30 pm, sgotte...@xxxxxxxxx wrote:
On Aug 4, 7:18 pm, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:





sgotte...@xxxxxxxxx wrote:
On Aug 4, 6:51 pm, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:
sgotte...@xxxxxxxxx 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...@xxxxxxxxxxxxx
==================- 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...@xxxxxxxxxxxxx
==================- 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


Simon,

This is way too setup-dependent. I could think of at least 20-30 ways to do it - if not more.

You need to be talking with your sysadmins to see how they set things up.


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



Relevant Pages

  • Re: [PHP] PHP Performance and System Load
    ... reasonably simple mod_rewrite is the difference that is killing your server ... to the time taken to parse code, hit the database, hit the disk, etc. ... Opcode cache is good, but if you can give it less to cache that ... PHP code itself is not the bottleneck but the server configuration, ...
    (php.general)
  • Re: obfuscating the code?
    ... so that the customere will have access to the php code. ... Apache web server to parse it and communicate with the mysql database and ... Do you think copyrighting your stuff will actually help anybody except ...
    (comp.lang.php)
  • Re: IIS and Apache to serve one PHP page?
    ... we have to use a non-traditional server setup ... Apache on a frontend server -> needing to connect to IIS on a backend ... page containing PHP code on the IIS server or otherwise specifically ... call PHP code on that other server. ...
    (comp.lang.php)
  • Re: obfuscating the code?
    ... The application we've developed will exist on a ?Wamp" or "EasyPHP" server, ... so that the customere will have access to the php code. ... the PHP interpreter can tell anyone with access to it what's going on under the hood. ...
    (comp.lang.php)
  • Re: redirect / new website how to redirect old (google) links to new site ?
    ... Configure your server to parse .html files for PHP. ... It's unnecessary overhead to parse static html files for PHP code. ...
    (comp.lang.php)