Instrumenting PHP CLI Applications

When instrumenting a PHP CLI application, you need to provide for the startup of the proxy daemon, as follows:

  1. Create the proxy control directory, which is used for agent/proxy communication.
  2. In your PHP configuration file, php.ini or appdynamics_agent.ini depending on your environment, include the following settings:
    • agent.cli_enabled = 1
    • agent.auto_launch_proxy = 0
    • agent.proxy_ctrl_dir = <proxy control directory> If you are using the RPM installer to install the agent you may have configured the proxy control directory using the APPD_PROXY_CTRL_DIR environment variable. See Install the PHP Agent by RPM. This environment variable takes precedence over the setting in the ini file.
  3. Before running any traffic through the CLI, run the proxy from the directory into which you installed the PHP agent, passing the proxy control directory and proxy log directory as arguments.
    OptionDescription
    Linux
    proxy/runProxy <proxy_control_dir> <log_dir>
    Windows
    proxy/runProxy.cmd <proxy_control_dir> <log_dir>
    For example:
    proxy/runProxy /tmp/proxy.communication /tmp/agentLogs
    For the full set of options to runProxy, see Start the PHP Agent Proxy Manually.