PHP agent on CentOS

Prerequisites

  • For prerequisite checks for agent installation, see Prerequisite checks for agent installation.
  • 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.

Downloading and installing the agent

Installing from the RPM package

  1. Download the RPM package to the machine where you need to setup the agent (file shared by Customer Support).
  2. The RPM package depends on the PHP version and the OS. You must install the package that is built based on the similar OS architecture and the PHP version. You must share the details of the OS, and PHP version.

Installing the dependency

yum install boost-devel
yum install php-curl

Installing the RPM package

rpm -i <sixthsense-agent-name>.rpm

Deleting the RPM package

rpm -e ss-php-agent
note
  • The package installs the PHP extension (.so file), and 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.
  • After removing the PHP agent RPM package remove the ini file for the configuration.

Run the following command to list the files added by the package.

rpm -qlp <rpm-file-name>

Environment variable:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib64

To verify the agent, run the following command:

ldd <path-to-php-extension>/skywalking.so

Verify if there is no missing shared library and configure the PHP agent ini file.

If the above installation process doesn't work, you can install it from the source using the following procedure.

Installing the agent from source

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 will need to build the PHP extension from the source files. The following procedures helps you build the agent.

Install gPRC and Protobuf on CentOS

note

You need cmake version 3.13 or later.

GRPC_RELEASE_TAG=ss-php-agent
GIT_SSL_NO_VERIFY=1
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib64
LD_RUN_PATH=$LD_RUN_PATH:/usr/local/lib:/usr/local/lib64
sudo yum install -y git make openssl unzip curl libcurl-devel autoconf gcc-c++ automake libtool openssl-devel epel-release cmake3
sudo yum install -y centos-release-scl && yum install -y devtoolset-7 scl-utils # (this is to change gcc version to 7)
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 cmake3 ../.. -DBUILD_SHARED_LIBS=ON -DgRPC_INSTALL=ON && sudo make -j$(nproc) && sudo make install && sudo make clean && sudo ldconfig

Installing the SixthSense agent on CentOS

  1. Copy SixthSense agent to /tmp directory to build and install the agent.
  2. Ensure that the phpize command is working. If not, install php-devel for your PHP version.
scl enable devtoolset-7 bash # (to change gcc version to v7)
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

Configuring the PHP agent ini file

Open the sixthsense.ini file and update the following fields (php --ini shows the ini file).

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 url>
skywalking.log_enable = 1
skywalking.proxy = http://35.200.147.154:3128
skywalking.http = https://http-collector-observability.sixthsense.rakuten.com/oap
skywalking.segmentSize = 3000
skywalking.httpTimeout = 30
skywalking.segmentFlushInterval = 3
skywalking.proxy= <proxy url >

For OneCloud Platform, use the following command:

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.log_enable = 1
In case of restricted environment, set the following parameters in the config.ini file:
skywalking.proxy = <proxy used for your internet access>
skywalking.http = https://sixthsense-backend.jpe2-caas1-prod1.caas.jpe2b.r-local.net/oap/
skywalking.segmentSize = 3000
skywalking.httpTimeout = 30
skywalking.segmentFlushInterval = 3
skywalking.proxy= <proxy url >

For running php-fpm, use the following command:

sudo php-fpm --nodaemonize & (won't work without the nodaemonize option)

While running using systemctl, if the libprotobuf.so.3.12.2.0 file is not found and an error is displayed, run the following command.

ln /usr/local/lib64/libprotobuf.so.3.12.2.0 /usr/lib64/libprotobuf.so.3.12.2.0