1 php protocolbuffers安装

时间:2022-09-19 20:16:15

安装工具

yum install autoconf yum install libtool

安装protoc编译器

# cd /root/soft/protobuf-2.7.

autogen.sh :

if test ! -e gmock; then
echo "Google Mock not present. Fetching gmock-1.7.0 from the web..."
curl $curlopts -O https://googlemock.googlecode.com/files/gmock-1.7.0.zip
unzip -q gmock-1.7..zip
rm gmock-1.7..zip
mv gmock-1.7. gmock
fi

将gmock放置在安装目录:

# cp ../gmock-1.7..zip .
# mv gmock-1.7..zip gmock

开始安装:

# ./autogen.sh # 生成configure脚本
# ./configure
# make
# make check
# make install /usr/local/bin/protoc

安装php的 php-protocolbuffers扩展 及 使用

# cd php-protocolbuffers-master
# phpize
# ./configure
# make
# make install

问题:

Can't find PHP headers in /usr/include/php
The php-devel package is required for use of this command.
# yum install php-devel
 

然后在你的php.ini配置文件中添加 extension = "protocolbuffers.so"

# php -m | grep protocolbuffers
protocolbuffers