Configuring PHP monitoring

You must configure the Monitoring Agent for PHP so that the agent can collect data from the PHP application that is being monitored.

Before you begin

  1. Ensure that you install the php-process package. If you use the yum install command to install PHP, run the yum install php-process command to install the php-process package.
  2. Ensure that the Apache HTTPD server is started before you configure the agent.
    Open the Apache HTTP Server httpd.conf configuration file and ensure that both the mod_status and ExtendedStatus On options are enabled. For example:
    ExtendedStatus On
    <Location /server-status>
    		SetHandler server-status
    		Order deny,allow
    		Allow from all
    		Allow from 127.0.0.1
    </Location>
    In the given example, http://127.0.0.1/server-status must work fine for the agent to work properly.
    Note: You must have Lynx or Links installed on Linux® for the agent to get monitoring data.

    Make sure that the command apachectl status works fine in the monitored Apache server with no code changes to the apachectl command. Lynx must be installed for the command apachectl status to work properly.

About this task

To avoid permission issues when you configure the agent, be sure to use the same root user or non-root user ID that was used for installing the agent. If you installed your agent as a selected user and want to configure the agent as a different user, see Configuring agents as a non-root user. If you installed and configured your agent as a selected user and want to start the agent as a different user, see Starting agents as a non-root user.

The PHP agent is a multiple instance agent; you must create the first instance and start the agent manually. The Managed System Name includes the instance name that you specify, for example, instance_name:host_name:pc, where pc is your two character product code. The Managed System Name is limited to 32 characters. The instance name that you specify is limited to 28 characters, minus the length of your host name. For example, if you specify PHP2 as your instance name, your managed system name is PHP2:hostname:PJ.
Important: If you specify a long instance name, the Managed System name is truncated and the agent code does not display correctly.

Procedure

  • If your environment is the same as the default settings, you can use the default execution binary path, default php.ini file path, and default port to configure the agent:
    1. Enter:
      install_dir/bin/php-agent.sh config instance_name install_dir/samples/php_silent_config.txt
      Where instance_name is the name you want to give to the instance, and install_dir is the PHP agent installation directory. The default installation directory is /opt/ibm/apm/agent.
    2. To start the agent, enter:
      install_dir/bin/php-agent.sh start instance_name
  • To configure the agent by editing the silent response file and running the script with no interaction, complete the following steps:
    1. Open install_dir/samples/php_silent_config.txt in a text editor.
    2. For Location of PHP execution binary, you can specify the directory where the PHP execution is located. The default location is /usr/local/bin.
    3. For Location of PHP INI file, you can specify the directory where the php.ini file is located. The default location is /etc.
    4. For Web server port, you can specify the port number of the web server that is running WordPress. The default is 80.
    5. For Application DocumentRoot, you can specify the DocumentRoot of the PHP WordPress application. Use a colon to separate multiple records. To allow the agent to find all the records for you, use the default value of ALL.
    6. Save and close the php_silent_config.txt file, then enter:
      install_dir/bin/php-agent.sh config instance_name install_dir/samples/php_silent_config.txt
      Where instance_name is the name that you want to give to the instance, and install_dir is the PHP agent installation directory. The default installation directory is /opt/ibm/apm/agent.
    7. To start the agent, enter:
      install_dir/bin/php-agent.sh start instance_name
  • To configure the agent by running the script and responding to prompts, complete the following steps:
    1. Enter:
      install_dir/bin/php-agent.sh config instance_name
      Where instance_name is the name you want to give to the instance, and install_dir is the PHP agent installation directory.
    2. When prompted to Edit Monitoring Agent for PHP settings, enter 1 to continue.
    3. When prompted for Location of PHP execution binary, press Enter to accept the default location or specify your own location.
    4. When prompted for Location of PHP INI file, press Enter to accept the default location or specify your own location.
    5. When prompted for Web server port, press Enter to accept the default port or specify a different port number.
    6. When prompted for Application DocumentRoot, press Enter to accept the default or specify the DocumentRoot of the PHP WordPress application. You can use a colon to separate multiple records.
    7. To start the agent, enter:
      install_dir/bin/php-agent.sh start instance_name

Results

The agent evaluates only the performance of PHP requests in WordPress applications. CSS and JS loading are not evaluated. The agent does not use URL arguments to identify URLs.

What to do next

You can verify the PHP agent data is displayed in the Cloud APM console.

You must ensure that the WordPress plugin-in for the agent is activated. To ensure activation, complete the following steps:
  1. In a web browser, enter the following URL http://hostname:port/wp-admin/.
  2. Access the administrative page by navigating to Plugins > Installed Plugins.
  3. Ensure that the PHP agent plug-in is activated. The PHP agent plug-in is listed as WordPress Agent. Typically, the plug-in is already activated. If it is not already activated, click on Activate.