Create PHP servers and PHP dynamic clusters

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

A PHP server is defined in Intelligent Management as an Apache HTTP Server with the mod_php module. We 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. We can define variables in the console to be used in the httpd.conf file. The php.ini file contains configuration data used by the PHP interpreter.

  1. Configure the middleware descriptors so that we can run discovery to find the Apache and PHP runtimes. In the 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 the 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 to host PHP servers. Discovery runs automatically when the node agent starts. Discovery also runs at a predefined time interval that we can specify in the middleware descriptor. However, we can also invoke discovery:

    1. In the console, click System administration > Middleware nodes.

    2. Select the nodes 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 console, click System administration > Middleware nodes > node > 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. We 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. We can create individual PHP servers or PHP dynamic clusters.

    • Create a PHP server.

      1. In the console, click Servers > New server. Choose Create a new server instance, and select the PHP server type. We 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, we can select the runtime that corresponds to either a specific or a general version that we need. For example, the most generic variables are APACHE and PHP, which always point to the newest versions that are installed on the node. Select these variables if you always want to use the newest runtimes and we do not need a specific version. We can also choose a runtime based on major version such as APACHE_2. With this variable, we can use any Apache 2 runtime. The newest Apache 2 runtime installed on the node is used. By always using the newest Apache Version 2 runtime, we can upgrade between minor versions without any manual server configuration changes. If we 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 console, click Servers > Clusters > Dynamic clusters > New.

      2. Choose the PHP server dynamic cluster type, and name the dynamic cluster.

      3. With PHP servers, 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 the 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 the PHP dynamic cluster.

  4. If we 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 created the PHP server with the APACHE22_PHP5 template.

    2. Open the httpd.conf file. In the 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 the 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 the 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 we can use when creating subsequent PHP servers. In the console, click Servers > Server types > PHP servers > Templates > New. Select the server from which to create a template, specify properties for the template, and save the changes. Choose this template when creating other PHP servers or dynamic clusters. We can also choose an existing server to create the 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 console, click Servers > Server types > PHP servers > php_server.

    2. Edit HTTP connector or HTTPS connector. Click OK and save and synchronize the changes.

What to do next

Deploy PHP applications to the PHP servers and dynamic clusters.

Related concepts

  • Middleware nodes and servers

    Related tasks

  • Create dynamic clusters
  • Add complete life-cycle middleware servers
  • Add, managing, and removing nodes
  • Deploy applications with defined service levels
  • Deploy PHP applications
  • Create middleware server templates
  • Configure middleware descriptors

  • addNode command
  • Intelligent Management: PHP server administrative tasks
  • Intelligent Management: dynamic cluster administrative tasks