当前位置:网站首页>Using Google protobuf protocol environment configuration in PHP

Using Google protobuf protocol environment configuration in PHP

2022-06-25 23:47:00 ndrandy

Two things need to be installed

  • protoc compiler
  • php-protobuf Expand

Be careful :protoc and php The extended version must be consistent , This way to V3.9.1 For example

There are many articles on the Internet , Installed PHP After expansion , It also needs to be composer To load the , Misleading , Extension mode and composer One out of two

 

Installation method :

  • install protoc

~# cd /data

~# wget -c https://github.com/protocolbuffers/protobuf/releases/download/v3.9.1/protoc-3.9.1-linux-x86_64.zip

~# unzip protoc-3.9.1-linux-x86_64.zip

~# cd bin/

~# mv protoc /usr/bin/ 

~# protoc --version

libprotoc 3.9.1

  •   install php-protobuf Expand ( Extended installation and self php The installation path is related to , Fine tune yourself according to the situation )

~# wget -c https://github.com/protocolbuffers/protobuf/releases/download/v3.9.1/protobuf-php-3.9.1.zip

~# unzip protobuf-php-3.9.1.zip

~# cd protobuf-3.9.1/php/ext/google/protobuf

~# /opt/php/bin/phpize

~# ./configure --with-php-config=/opt/php/bin/php-config

~# make

~# make install

phpinfo View can see :

protobuf

Version => 3.9.1

  This way , The entire environment has been successfully configured

原网站

版权声明
本文为[ndrandy]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206252056449811.html