protocbuf php,php-protocbuf插件安装

下载protobuf-2.4.1.tar.gz:

http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.gz

安装:

tar zxvf protobuf-2.4.1.tar.gz

cd protobuf-2.4.1

./configure

make

make check

make install

安装结束。

验证:

查看是否安装成功:protoc –version

如果出现:libprotoc 2.4.1 则说明安装成功!

vi /etc/profile

执行: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

protobuf是google出的一个结构化信息传递的工具,用于传递自定的strcut xxx {}内容。可用于在一个机器上的进程间,两台设备各自的进程间,等等。php的protobuf扩展叫php-protobuf。

下载地址:https://github.com/allegro/php-protobuf/

解压 && 安装

unzip php-protobuf-master.zip

cd php-protobuf-master

/alidata/server/php/bin/phpize

./configure –with-php-config=/alidata/server/php/bin/php-config

make && make install

然后再php.ini中添加protobuf.so扩展

extension=protobuf.so

重启php-fpm后运行phpinfo();看扩展是否添加成功了。

/alidata/server/php/bin/php /tmp/php-protobuf-master/protoc-php.php /tmp/tanx-bidding.proto