PHP GRPC

安装pecl
apt-get install -y php-pear
安装phpize
apt-get install -y php7.0-dev
安装grpc扩展

有扩展包

pecl install /tmp/grpc-1.14.0.tgz

无扩展包

pecl install grpc

php.ini中添加

extension=grpc.so
Build process completed successfully
Installing '/usr/lib/php/20151012/grpc.so'
install ok: channel://pecl.php.net/grpc-1.14.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=grpc.so" to php.ini
安装protoc扩展

有扩展包

pecl install /tmp/protobuf-3.6.0.tgz

无扩展包

sudo pecl install protobuf

php.ini中添加

extension=protobuf.so
Build process completed successfully
Installing '/usr/lib/php/20151012/protobuf.so'
install ok: channel://pecl.php.net/protobuf-3.6.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=protobuf.so" to php.ini
安装protobuf-php、grpc_php_plugin
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protobuf-php-3.6.1.tar.gz

tar -zxvf protobuf-php-3.6.1.tar.gz
cd protobuf-php-3.6.1
./configure --prefix=/usr/src
make && make install
$ cd /var
$ git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc
$ cd grpc
$ git submodule update --init
$ make grpc_php_plugin
protoc --proto_path=./   --php_out=./   --grpc_out=./   --plugin=protoc-gen-grpc=/var/grpc/bins/opt/grpc_php_plugin   ./../protos/helloworld.proto

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值