SkyWalking PHP Agent 官方文档
官方文档
Install SkyWalking PHP Agent
Requirements
When building directly from Git sources or after custom modifications you might also need:
gRPC and Protobuf
php v7.0 or newer
SkyWalking oap server
SkyWalking UI
CMake v3.13 or newer
Install gPRC ans Protobuf
View official documents GRPC C++ installation
View official documents protobuf C++ installation
Ubuntu
sudo apt-get install build-essential autoconf automake libtool curl make g++ unzip pkg-config cmake
git clone --depth 1 -b v1.34.x https://github.com/grpc/grpc.git /var/local/git/grpc
cd /var/local/git/grpc
git submodule update --init --recursive
protobuf
cd /var/local/git/grpc/third_party/protobuf
./autogen.sh
./configure
make -j$(nproc)
sudo make install
sudo ldconfig
make clean
grpc
cd /var/local/git/grpc
mkdir -p cmake/build
cd cmake/build
cmake ../.. -DBUILD_SHARED_LIBS=ON -DgRPC_INSTALL=ON
make -j$(nproc)
sudo make install
make clean
sudo ldconfig
Alpine
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
apk --update add --no-cache git ca-certificates autoconf automake libtool g++ make file linux-headers file re2c pkgconf openssl openssl-dev curl-dev nginx
git clone --depth 1 -b v1.34.x https://github.com/grpc/grpc.git /var/local/git/grpc
cd /var/local/git/grpc
git submodule update --init --recursive
protobuf
cd /var/local/git/grpc/third_party/protobuf
./autogen.sh
./configure
make -j$(nproc)
sudo make install
make clean
grpc
cd /var/local/git/grpc
mkdir -p cmake/build
cd cmake/build
cmake ../.. -DBUILD_SHARED_LIBS=ON -DgRPC_INSTALL=ON
make -j$(nproc)
sudo make install
make clean
Install PHP Extension
curl -Lo v4.1.1.tar.gz https://github.com/SkyAPM/SkyAPM-php-sdk/archive/v4.1.1.tar.gz
tar zxvf v4.1.1.tar.gz
cd SkyAPM-php-sdk-4.1.1
phpize
./configure
make
sudo make install
How to use
Add SkyWalking config to php.ini and restart php-fpm
; Loading extensions in PHP
extension=skywalking.so
; enable skywalking
skywalking.enable = 1
; Set skyWalking collector version (5 or 6 or 7 or 8)
skywalking.version = 8
; Set app code e.g. MyProjectName
skywalking.app_code = MyProjectName
; Set grpc address
skywalking.grpc=127.0.0.1:11800
Important
Make sure php-fpm is running in foreground mode
Trouble Shooting
Nothing Receiving in OapService?
Check your php-fpm start mode. It must start with "--nodaemonize" to stay php-fpm in foreground.
标题:SkyWalking PHP Agent 官方文档
作者:LeeOcean
地址:https://www.leiocean.com/articles/2021/05/08/1620446828047.html
