PHP agent on Ubuntu

The PHP agent for SixthSense does the following:

  • Monitors your application to help you identify and find the root cause of performance issues.
  • Extends the agent's performance by collecting and analyzing business data to help you improve customer experience.
  • Helps in data-driven business decisions.

Prerequisites

  • SixthSense Agent - provided by Customer Support.
  • URL/IP of the SixthSense collector (your tenant URL which will be provided by Customer Support).
  • Access token from the SixthSense portal. For accessing the token, see Accessing your Access Token under Getting started with the Observability Portal.
  • Variables: TOKEN from the SixthSense portal. See Accessing your Access Token under Getting started with the Observability Portal.
note

Requests should be handled php-fpm for the agent to intercept requests.

Installing from the Debian package

  1. Download the Debian package to the machine where the agent must be setup (file will be shared by Customer Support). The Debian package depends on the php version and the OS. You must install the package that is built in a similar environment (share details of architecture, os, and php version).
  2. Install dependency

apt install libboost-all-dev

apt install php<php-version>-curl

  1. Install the Debian package.

dpkg -i <sixthsense-agent-name>.deb

Deleting the Debian package

dpkg -r ss-php-agent

note

The package installs the php extension (.so file) and the GRPC/protobuf (.so) files in /usr/local/lib directory. Any existing GRPC, protobuf .so files will be overridden. Deleting the package will remove all the installed files.

If the above procedure doesn't work, you can use the following procedure to install it from the source.

Downloading the PHP agent

  1. Download the PHP agent provided by Customer Support.
  2. Install gPRC and Protobuf on Ubuntu.

Installing the PHP agent

PHP agent is installed as PHP extension and is responsible for instrumentation of all the incoming and outgoing calls from the system. Since PHP Agent is installed as PHP extension, you must build the PHP extension from the source files. The following procedure helps you build the agent.

Installing gPRC and Protobuf on Ubuntu

note

You need version 3.13 or later of cmake.

If the cmake version is not satisfied install it manually using the following command.

curl -L -o cmake-3.19.1.tar.gz https://github.com/Kitware/CMake/releases/download/v3.19.1/cmake-3.19.1.tar.gz \
&& tar zxf cmake-3.19.1.tar.gz \
&& cd cmake-3.19.1 && ./bootstrap && make -j$(nproc) && make install
GRPC_RELEASE_TAG=ss-php-agent
GIT_SSL_NO_VERIFY=1
sudo apt-get update && sudo apt-get install -y \
autoconf automake libtool curl make g++ unzip \
build-essential libtool pkg-config \
git ca-certificates cmake libcurl4-openssl-dev re2c
sudo git clone --depth 1 -b ${GRPC_RELEASE_TAG} https://artifacts-observability.sixthsense.rakuten.com/sixthsense-repositories/grpc.git /var/local/git/grpc
cd /var/local/git/grpc && sudo git config --global url.https://github.com/.insteadOf git://github.com/
cd /var/local/git/grpc && sudo git submodule update --init --recursive
cd /var/local/git/grpc/third_party/protobuf && sudo ./autogen.sh && sudo ./configure && sudo make -j$(nproc) && sudo make install && sudo make clean && sudo ldconfig
cd /var/local/git/grpc && sudo mkdir -p cmake/build && cd cmake/build && sudo cmake ../.. -DBUILD_SHARED_LIBS=ON -DgRPC_INSTALL=ON && sudo make -j$(nproc) && sudo make install && sudo make clean && sudo ldconfig

After installing protobuf do the following:

  • Export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib64
  • Export LD_RUN_PATH=$LD_RUN_PATH:/usr/local/lib:/usr/local/lib64

Installing the SixthSense agent on Ubuntu

  • Copy the SixthSense agent to /tmp directory to build and install the agent using the following command.
cd /tmp/sixthsense-php-agent && sudo phpize && sudo ./configure && sudo make && sudo make install
sudo cp php.ini/Php extension directory base/conf.d/ext-skywalking.ini
  • Open the $PHP_INI_DIR/conf.d/ext-skywalking.ini file and update the following fields.
PHP
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
skywalking
extension=skywalking.so
skywalking.app_code = <Your_service_name>
skywalking.authentication = <Your_auth_token>
skywalking.teamID = <Your_team_id>
skywalking.enable = 1
skywalking.version = 8
skywalking.grpc = grpc-collector-observability.sixthsense.rakuten.com:443
skywalking.log_enable = 1
skywalking.grpc_tls_enable = 1
skywalking.grpc_tls_pem_root_certs=
skywalking.grpc_tls_pem_private_key=
skywalking.grpc_tls_pem_cert_chain=
skywalking.proxy= <proxy url >

You have now installed and initialised the agent. The traffic flowing to an application will be captured and you can view it on the SixthSense dashboard.