Create PHP servers and PHP dynamic clusters
By creating PHP Hypertext Preprocessor (PHP) servers or dynamic clusters, we can deploy PHP applications. Use the product to manage these applications and servers.
- Install Apache HTTP Server and PHP on the nodes 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.
- If we are using Apache HTTP Server Version 2.2 and PHP v5.2 (all releases), then we must perform some manual edits to the httpd.conf file. Instead of performing these edits each time we 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 we can use to create the rest of our PHP servers.
We can also choose an existing server to use as the template for a new PHP server using the PHP server administrative tasks, or by selecting a predefined server instead of a template. We cannot select a user-defined template from the PHP server wizard.
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 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 administrative console to be used in the httpd.conf file. The php.ini file contains configuration data used by the PHP interpreter.
Tasks
- Configure the middleware descriptors so that we 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 the environment. Use a semicolon delimiter for Windows paths, and a colon delimiter for UNIX paths.
- 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:
- In the administrative console, click...
System administration > Middleware nodes.
- Select the nodes to run through discovery, and select the Run discovery operational action.
- Click Run.
- Verify that the discovery service found the run time. In the administrative 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.
- Create PHP deployment targets. The deployment target is where we deploy the PHP application. Create individual PHP servers or PHP dynamic clusters.
- Create a PHP server.
- In the administrative 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.
- Select the node on which we want the PHP server to run. This node must have the PHP and Apache HTTP Server runtime environments.
- 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 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 v2 runtime, we can upgrade between minor versions without any manual server configuration changes. If we 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.
- Choose the PHP server template.
- Confirm and save the PHP server.
- Create a PHP dynamic cluster.
- In the administrative console, click...
Servers > Clusters > Dynamic clusters > New
- Choose the PHP server dynamic cluster type, and name the dynamic cluster.
- With PHP servers, we 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, we might use the following membership policy:
node_property$APACHE IS NOT NULL and node_property$PHP IS NOT NULLRestriction: 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- Select the server template for the PHP runtime and Apache HTTP Server runtime that we are using.
- Specify other dynamic cluster properties.
- Save PHP dynamic cluster.
- If we are using PHP v5.2 (any release), then we must manually edit the httpd.conf file to use the php5apache2_2.dll module, instead of the default php5apache2.dll module.
- Verify that we created the PHP server with the APACHE22_PHP5 template.
- Open the httpd.conf file.
In the administrative console, click...
Servers > Server types > PHP servers > php_server > External configuration > httpd.conf > Retrieve
- 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 our 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"
- Apply and save the changes.
- Optional: To avoid repeating these steps for each PHP v5.2 server that we create, make a template of your current server we can use when we create subsequent PHP servers. In the administrative console, click...
Servers > Server types > PHP servers > Templates > New
Select the server from which we want to create a template, specify properties for the template, and save the changes. Choose this template when we create other PHP servers or dynamic clusters. We can also choose an existing server to create the new PHP server from the PHP server wizard.
- Optional: Update the HTTP and HTTPS ports for the servers. The default port is uniquely generated. modifying the port changes the port for the Apache server, which updates the httpd.conf file.
- In the administrative console, click...
Servers > Server types > PHP servers > php_server.
- Edit HTTP connector or HTTPS connector. Click OK and save and synchronize changes.
What to do next
Deploy PHP applications to your PHP servers and dynamic clusters.
Related:
Middleware nodes and servers Create dynamic clusters Add complete life-cycle middleware servers (deprecated) Add, manage, and remove 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