/

PHP 安装 gRPC

ENV

cat /etc/redhat-release

CentOS Linux release 7.2 (Final)

uname -a
Linux xxx-xxx 3.10.107-1-tlinux2_kvm_guest-0052 #1 SMP Wed Jan 15 18:42:19 CST 2020 x86_64 x86_64 x86_64 GNU/Linux

PECL

pecl install grpc

如果遇到:

Connection to `ssl://pecl.php.net:443′ failed:

参考:

PHP Swoft 框架环境配置 | ZYF.IM

Build

通用手动安装 PECL 扩展

For this to work, you’ll need to have root access to your server, and you’ll most probably need developer tools installed as well.

https://pecl.php.net/

# 创建临时目录
mkdir /tmp/download/ && cd /tmp/download/
# 下载
wget http://pecl.php.net/get/[extension].tgz
# 解压
tar -xvf [extension].tgz
cd [extension]
# 配置
phpize
# 查看参数
./configure --help
# 设置参考 以实际情况为准
./configure --enable-[extension]
# 编译
make && make test
# 安装
make install
# 查看 ini 路径
php --ini
# 开启
vi [php-ini].ini
extension=[extension].so

gcc is currently not installed

yum install gcc

...already installed and latest version...

gcc

...gcc is currently not installed.

yum reinstall gcc
# 重新安装后解决

GrpcLb::TokenAndClientStatsAttribute::ToString() const

原因:gcc 版本过低。

yum install centos-release-scl

yum install devtoolset-8-gcc*

scl enable devtoolset-8 bash

source /opt/rh/devtoolset-8/enable

References

– EOF –