Set up the Agentedit

Install the agent using one of the packages for supported platforms.

The agent supports PHP versions 7.2-8.0.

Using RPM package (RHEL/CentOS, Fedora)edit

rpm -ivh <package-file>.rpm

Using DEB package (Debian, Ubuntu)edit

dpkg -i <package-file>.deb

Using APK package (Alpine)edit

apk add --allow-untrusted <package-file>.apk

Build from sourceedit

If you can’t find your distribution, you can install the agent by building it from the source.

The agent is currently only available for Linux operating system.

  1. Download the agent source from https://github.com/elastic/apm-agent-php/.
  2. Execute the following commands to build the agent and install it:
cd src/ext
phpize
CFLAGS="-std=gnu99" ./configure --enable-elastic_apm
make clean
make
sudo make install

Enable the extension by adding the following to your php.ini file:

extension=elastic_apm.so
elastic_apm.bootstrap_php_part_file=<repo root>/src/bootstrap_php_part.php

To work, the agent needs both the built elastic_apm.so and the downloaded source files. So if you would like to build elastic_apm.so on one machine and then deploy it on a different machine, you will need to copy both the built elastic_apm.so and the downloaded source files.