IBM®
Skip to main content
    Country/region [select]      Terms of use
 
 
     Home      Products      Services & solutions      Support & downloads      My account     
  IBM Wikis > PHP: Zend for i5/OS > ... > 03-00-00 Chapter 3. Administration > 03-04-00 Configuring multiple instances
PHP: Zend for i5/OS Log In | Sign Up   View a printable version of the current page.
03-04-00 Configuring multiple instances
Added by admin, last edited by Gary Mullen-Schultz on Sep 11, 2007  (view change)
Labels: 
(None)

Show/Hide Navigation Tree
Navigation Tree

TOC Previous Next

Configuring multiple instances

The long history of System i5 (and its predecessors) as a centralized, multi-user machine makes multiple-instance support a common requirement in i5/OS products. The following pages describe a few of the more common scenarios involving multiple instances.

Having the ability to host PHP applications from more than one web server is very important, and is fully supported. There are several ways to implement multiple instances of PHP under i5/OS. Note that the vast majority of configuration required to accomplish each scenario is specific to Apache rather than to i5/OS or the PHP environment. Thus, multiple instance configuration on i5/OS is largely identical to performing the same task on any other operating system that supports the Apache web server. Note that this list of scenarios is not exhaustive; by adding technologies such as virtual hosts one can imagine other variations.

At this time, Zend Core for i5/OS does not support multiple installations of the product on the same system partition. By "multiple installations" we mean the ability to have more than one version of the product installed within the same partition of i5/OS. For example, with IBM WebSphere Application Server it is possible to have versions 5.0, 6.0, and 6.1 all installed simultaneously within a single i5/OS partition. Most customers do not require this functionality, and can achieve the same results via different means (multiple i5/OS partitions, multiple hardware platforms, etc.).

Important: Remember that you should be signed on as QSECOFR when starting and stopping web server instances using the "apachectl" command. Using any other user profile makes it impossible for Zend Core for i5/OS to switch to the NOBODY user profile for the jobs under which PHP scripts execute.


Multiple i5/OS Apache instances, one PHP server

This scenario entails having multiple instances of IBM HTTP Server for i5/OS (i5/OS Apache), all forwarding their requests on to a single instance of Apache/PHP in PASE for i5/OS.

Figure 3-12 shows a representation of this scenario:

Figure 3-12 Multiple i5/OS Apache instances, one PHP server

In this case, we see three IBM HTTP Server for i5/OS instances. This could be accomplished in various ways - for example, we could have a single IBM HTTP Server for i5/OS instance listen on multiple ports. One example of where this may be a desirable option is when you want to have both HTTP (by default, port 80) and HTTPS (by default, port 443) exposed to the internet/intranet, but want only one PHP server to handle all these requests.

Figure 3-13 shows how this configuration could be done via the HTTP Server Administration utility available on port 2001. In this example we see a second port, in this case port 666, added to our ZENDCORE instance. The default reverse proxy configuration (done by the Zend Core for i5/OS installation program) is already configured for this instance, meaning that all requests received on ports 89 and 666 will be sent on to the internal (PASE for i5/OS) server listening on port 8000.


Figure 3-13 Adding a second port (666) to the ZENDCORE instance

Multiple i5/OS Apache instances, multiple PHP servers

This scenario involves having multiple instances of IBM HTTP Server for i5/OS (i5/OS Apache) forwarding requests to multiple instances of Apache/PHP running in PASE for i5/OS. There are several reasons you may want to consider such a scenario: for example, if you are hosting applications for other companies and want to ensure that the applications run in completely separate memory spaces. Another reason someone may consider such a scenario would be to allow a production PHP server to exist on the same physical partition where developers or system administrators are creating PHP applications or environments. Clearly we don't want to bring down the production server when a developer wants to make a change requiring a restart of the PHP environment.

Figure 3-14 shows a diagram outlining how this scenario might be visualized:
Figure 3-14 Multiple i5/OS Apache instances, multiple PHP servers

Again, there are many different ways one can create configurations to resemble the environment shown in Figure 3-14. We saw in "Multiple i5/OS Apache instances, one PHP server" how we could add a second listening port to the existing ZENDCORE server configuration. Of course, another option would be to create a second configuration that can be independently started/stopped, and which listens on a different port.

The easiest way to allow for the creation of a new Apache/PHP instance in PASE for i5/OS is as follows:

First, create a new version of the "php.ini" file, which is found in directory "/usr/local/Zend/Core/etc." In our case, we copied "php.ini" to a new file called "php2.ini." Make any desired modifications to the new file.

Next, create a new version of the "httpd.conf" file found in directory "/usr/local/Zend/apache2/conf." In our case, we created a copy of "httpd.conf" called "httpd2.conf" in the very same directory.

You must now edit the "httpd2.conf" file to make it a unique configuration. The following are some of the lines you should modify:

Example 3-1 Lines to change in httpd2.conf to create new Apache/PHP instance

PidFile logs/httpd2.pid
...
DocumentRoot "/www/zendcore/htdocs2"
...
<Directory "/www/zendcore/htdocs2">
...

Of course, there are others you may want to modify as well, depending on your configuration and your goals.

The following line should be added to "httpd2.conf" to point it at the new "php2.ini" file:

Example 3-2 Lines to add in httpd2.conf to create new Apache/PHP instance

### Start of Zend Core
PHPINIDir /usr/local/Zend/Core/etc/php2.ini

You should now be able to start this second instance by issuing a command similar to the following (from a QP2TERM session of PASE for i5/OS)::
/usr/local/Zend/apache2/bin/apachectl
-f /usr/local/Zend/apache2/conf/httpd2.conf
-k start

As a reminder, the instance can then be stopped, started or restarted by adding the "-k" flag as follows:
Stop -k stop
Start -k start
Restart -k restart

Important: Whenever issuing these commands make sure you also specify the "-f" flag and specify which configuration file to use.


This allows you to independently start or stop any IBM HTTP Server for i5/OS or Apache/PHP in PASE for i5/OS instance you like.

One i5/OS Apache instance, multiple PHP servers

In this scenario, we have a single instance of IBM HTTP Server for i5/OS (only one port exposed to the intranet/internet) sending requests to multiple Apache/PHP server instances. Most likely the decision of which Apache/PHP server the request should be routed to will be made based on the URL.

Figure 3-15 shows one way to view this scenario:

Figure 3-15 One i5/OS Apache instance, multiple PHP servers

To take advantage of both Apache/PHP servers we could configure our IBM HTTP Server for i5/OS instance using the IBM Web Administration for i5/OS tool (port 2001) as shown in Figure 3-16:


Figure 3-16 Adding second reverse proxy configuration

In this case, any incoming requests that specify "/garymu" on the URL (for example, "http://mysystem.ibm.com/garymu/myfile.php") would be sent to the Apache/PHP instance in PASE for i5/OS that is listening on port 8001; all other requests (ones that do not specify "/garymu") will be sent to the default server on port 8000. Note that the two configuration items for "/garymu" and port 8001 must be above those for "/" and port 8000, as "/" is a catch all. If it is first in the list, no requests will ever flow down the list to test for other matches.

 

Name based virtual hosting

ISP's that run multiple websites for may clients can use a technique called Name Based Hosting to allow them to serve up many customers websites from a single IP address on their server.  The IP is set up in the DNS for each of the websites, when a request is received the web server can determine the correct website to publish based on the content of the request from the client browser. To allow this to function in the IBM system i5  php environment you have to add extra configuration lines into your config files.


 Figure 3-17 Name Based Hosting
 
To allow the above configuration to work you must add a PreserveProxyHost directive to the servers config files to ensure that the requested URL is passed onto the subsequent server for PHP to publish the correct pages.  Each of the Virtual Servers in the IBM HTTP Server must be duplicated in the PASE Apache HTTP server.
 
To Add....
Copy of a sample config for the Apache server and the IBM HTTP server.
Pictures which show the relationship between the config files.
Pictures from the IBM HTTP interface showing how to configure Virtual hosts.
Picture of the IFS setup for a sample configuration.
.....> 
 
TOC Previous Next

Top 5 contributors
to this page
UserEdits
admin 2
Chris Hird 2
Gary Mullen-Schultz 1
Mike Schwartz 1

You say that you can make changes by typing in the following:

 
/usr/local/Zend/apache2/bin/apachectl
-f /usr/local/Zend/apache2/conf/httpd2.conf
-k start

Where do I type this in at?  

Thanks 

Posted by Anonymous at Aug 24, 2007 10:15 | Permalink

Good question - from a QP2TERM session of PASE for i5/OS. 

I added that to the text above.

Thanks for the comment!

 Gary

Posted by Gary Mullen-Schultz at Sep 11, 2007 16:54 | Permalink
The postings on this site solely reflect the personal views of the authors and do not necessarily represent the views, positions, strategies or opinions of IBM or IBM management.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.10 Build:#528 Nov 29, 2006)
    About IBM Privacy Contact