php安装grpc扩展的具体步骤

 更新时间:2021年07月05日 08:46:21   作者:小妮浅浅  
在本篇文章里小编给大家整理的是一篇关于php安装grpc扩展的具体步骤,有需要的朋友们可以跟着学习参考下。

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。

 安装中出现的问题:

结果报错了:

Error:src/core/lib/compression/message_compress.lo' failed

这个又是神马情况,在网上搜索了一通,原来是在编码的时候,虚招zlib发现没有这个文件,怎么办?装呗

apt-get install zlib1g-dev


 

然后在执行以下pecl install grpc发现居然安装上去了,根据安装提示需要将grpc.so添加到php.ini文件中方便查看;

echo "extension=grpc.so" >> /etc/php/7.2/cli/php.ini


 

记得重启下:service php7.2-fpm restart

查看模块: php -m | grep "grpc"

至此,这个grpc安装完成了!

到此这篇关于php安装grpc扩展的具体步骤的文章就介绍到这了,更多相关php安装grpc扩展的方法内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

相关文章

最新评论