+

Search Tips   |   Advanced Search

Operating Systems: AIX, HP-UX, Linux, Solaris, 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

 

About this task

A PHP server is defined in WebSphere® Virtual Enterprise as an Apache HTTP Server with the mod_php module. You can define a PHP server on nodes that are running WebSphere XD or the middleware 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 to host PHP servers. Discovery runs automatically when the middleware 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 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 > Add a server. Choose Create a new server instance, and select the PHP server type. You can also click Servers > Other middleware servers > 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 V2 runtime, you can upgrade between minor versions without any manual server configuration changes. If you update from Apache V2.0.58 to Apache V2.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 > 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 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 V5.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 > Other middleware servers > 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 V5.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 > Other middleware servers > 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 > Other middleware servers > 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.



Previous topic
Federating middleware nodes

Next topic

Deploying applications with defined service levels

Next topic

Deploying PHP applications

 

Related concepts


Middleware nodes and servers

 

Related tasks


Creating dynamic clusters
Creating middleware server templates
Configure middleware descriptors Adding complete life cycle middleware servers

 

Related reference


PHP server administrative tasks
Dynamic cluster administrative tasks