首页 > 文章列表 > php安装grpc扩展的方法

php安装grpc扩展的方法

php grpc
360 2022-08-06

1、在php.ini文件中添加grpc扩展配置:extension=grpc.so

git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc
cd grpc
git submodule update --init
make
make install
cd src/php/ext/grpc
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
vi /usr/local/php/etc/php.ini

2、安装 protobuf及其php扩展

cd ../../../../third_party/protobuf
./autogen.sh
./configure
make
make install
cd php/ext/google/protobuf
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
vi /usr/local/php/etc/php.ini

3、重启php-fpm。