1、在php.ini文件中添加grpc扩展配置:extension=grpc.so
git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpccd grpcgit submodule update --initmakemake installcd src/php/ext/grpcphpize./configure --with-php-config=/usr/local/php/bin/php-configmakemake installvi /usr/local/php/etc/php.ini
2、安装 protobuf及其php扩展
cd ../../../../third_party/protobuf./autogen.sh./configuremakemake installcd php/ext/google/protobufphpize./configure --with-php-config=/usr/local/php/bin/php-configmakemake installvi /usr/local/php/etc/php.ini
3、重启php-fpm。
以上就是php安装grpc扩展的方法,希望对大家有所帮助。