[AIX Solaris HP-UX Linux Windows][z/OS]

Creating PHP servers and PHP dynamic clusters

By creating PHP Hypertext Preprocessor (PHP) servers or dynamic clusters, you can deploy PHP applications. You can use the product to manage these applications and servers.

Before you begin

  • Install Apache HTTP Server and PHP on the nodes that you want to host PHP servers. The supported Apache HTTP Server versions are 1.3 (all releases), 2.0 (all releases), and 2.2 (all releases). The supported PHP versions are 4 and 5 (all releases). Default server templates are provided for these combinations of Apache HTTP Server and PHP.
  • Federate these nodes into the cell.
  • Attention: If you are using Apache HTTP Server Version 2.2 and PHP Version 5.2 (all releases), then you must perform some manual edits to the httpd.conf file. Instead of performing these edits each time you create a PHP server or dynamic cluster, create a PHP server with the APACHE22_PHP5 template, edit the httpd.conf file, and create a server template from that server, which you can use to create the rest of your PHP servers.

    You can also choose an existing server to use as the template for a new PHP server by using the PHP server administrative tasks, or by selecting a predefined server instead of a template. You cannot select a user-defined template from the PHP server wizard.

About this task

A PHP server is defined in Intelligent Management as an Apache HTTP Server with the mod_php module. You can define a PHP server on nodes that are running the product or the node agent. PHP server configuration consists of three documents: the server.xml, httpd.conf and php.ini files. The server.xml file contains properties that describe the Apache and PHP runtime locations and server operations. The httpd.conf file is the Apache HTTP Server configuration file that includes PHP modules. You can define variables in the administrative console to be used in the httpd.conf file. The php.ini file contains configuration data that is used by the PHP interpreter.

Procedure

  1. Configure the middleware descriptors so that you can run discovery to find the Apache and PHP runtimes.
    In the administrative console, click System administration > Middleware descriptors > middleware_platform_name. The default locations are listed in the apacheWebServerRuntime and phpRuntime middleware descriptors. The discovery service uses middleware descriptors to define where to look for the Apache and PHP runtimes. Verify that the middleware descriptors contain the correct installation locations for your environment. Use a semicolon delimiter for Windows paths, and a colon delimiter for UNIX paths.
  2. Run discovery to find the PHP and Apache HTTP Server runtimes on the nodes that you want to host PHP servers.
    Discovery runs automatically when the node agent starts. Discovery also runs at a predefined time interval that you can specify in the middleware descriptor. However, you can also invoke discovery:
    1. In the administrative console, click System administration > Middleware nodes.
    2. Select the nodes that you want to run through discovery, and select the Run discovery operational action.
    3. Click Run.
    4. Verify that the discovery service found the run time.
      In the administrative console, click System administration > Middleware nodes > node_name > Node installation properties. If any runtime environments exist, then properties that begin with APACHE or PHP strings are displayed.
    Only the default installation locations are listed in the apacheWebServerRuntime and phpRuntime middleware descriptors. You can modify the middleware descriptor so that the discovery looks for the correct installation location.
  3. Create PHP deployment targets.
    The deployment target is where you deploy the PHP application. You can create individual PHP servers or PHP dynamic clusters.
    • Create a PHP server.
      1. In the administrative console, click Servers > New server. Choose Create a new server instance, and select the PHP server type. You can also click Servers > Server types > PHP servers > New.
      2. Select the node on which you want the PHP server to run. This node must have the PHP and Apache HTTP Server runtime environments.
      3. Choose the appropriate Apache HTTP Server and PHP runtime environments for the node.

        For both runtimes, a list of variables displays at different levels of granularity such as APACHE, APACHE_2, APACHE_2_0, and APACHE_2_0_59. With these variables, you can select the runtime that corresponds to either a specific or a general version that you need. For example, the most generic variables are APACHE and PHP, which always point to the newest versions that are installed on your node. Select these variables if you always want to use the newest runtimes and you do not need a specific version. You can also choose a runtime that is based on major version such as APACHE_2. With this variable, you can use any Apache 2 runtime. The newest Apache 2 runtime that is installed on your node is used. By always using the newest Apache Version 2 runtime, you can upgrade between minor versions without any manual server configuration changes. If you update from Apache Version 2.0.58 to Apache Version 2.0.59 and add the new runtime location to the middleware descriptor, the runtime service automatically detects the newer runtime and updates the server configuration to point to the new runtime.

      4. Choose the PHP server template.
      5. Confirm and save the PHP server.
    • Create a PHP dynamic cluster.
      1. In the administrative console, click Servers > Clusters > Dynamic clusters > New.
      2. Choose the PHP server dynamic cluster type, and name the dynamic cluster.
      3. With PHP servers, you must use automatic membership. Define a membership policy to identify which nodes host the PHP servers in the dynamic cluster. These nodes must have the PHP and Apache HTTP Server runtime environments installed.
        For example, you might use the following membership policy:
        node_property$APACHE IS NOT NULL and node_property$PHP IS NOT NULL
        Restriction: PHP dynamic cluster members must be at the same two digit Apache version and one digit PHP version. This limitation is caused by the differences in configuration between releases. If multiple versions are installed on your system, update the membership policy to include the version number, like in the following example:
        node_property$APACHE_2_0 IS NOT NULL and node_property$PHP_4 IS NOT NULL
      4. Select the server template for the PHP runtime and Apache HTTP Server runtime that you are using.
      5. Specify other dynamic cluster properties.
      6. Save your PHP dynamic cluster.
  4. If you are using PHP Version 5.2 (any release), then you must manually edit the httpd.conf file to use the php5apache2_2.dll module, instead of the default php5apache2.dll module.
    1. Verify that you created the PHP server with the APACHE22_PHP5 template.
    2. Open the httpd.conf file.
      In the administrative console, click Servers > Server types > PHP servers > php_server_name > External configuration. Choose the httpd.conf file, and click Retrieve.
    3. Modify the file to use the php5apache2_2.dll module.
      Search for the following string in the httpd.conf file, where php_server_root is the location of your PHP server:
      LoadModule php5_module "php_server_root/php5apache2.dll"
      Edit this line to reference the php5apache2_2.dll module.
      See the following example:
      LoadModule php5_module "php_server_root/php5apache2_2.dll"
    4. Apply and save your changes.
    5. Optional: To avoid repeating these steps for each PHP Version 5.2 server that you create, make a template of your current server that you can use when you create subsequent PHP servers.
      In the administrative console, click Servers > Server types > PHP servers > Templates > New. Select the server from which you want to create a template, specify properties for the template, and save your changes.
      Choose this template when you create other PHP servers or dynamic clusters. You can also choose an existing server to create your new PHP server from the PHP server wizard.
  5. Optional: Update the HTTP and HTTPS ports for your servers.
    The default port is uniquely generated. modifying the port changes the port for the Apache server, which updates the httpd.conf file.
    1. In the administrative console, click Servers > Server types > PHP servers > php_server.
    2. Edit HTTP connector or HTTPS connector. Click OK and save and synchronize your changes.

What to do next

Deploy PHP applications to your PHP servers and dynamic clusters.