亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

GO為server,PHP為client的實踐

發布時間:2020-07-06 11:08:10 來源:網絡 閱讀:249 作者:dfwasds 欄目:web開發

1> Ubuntu16.04 集成的go包是1.6,后期有坑,直接安裝1.9.
To install Go 1.9 on Ubuntu 16.04, first add the PPA and install the golang-1.9-go package:

sudo add-apt-repository ppa:gophers/archive
sudo apt update
sudo apt-get install golang-1.9-go
The add go the go path to the your PATH:

echo "export PATH=$PATH:/usr/lib/go-1.9/bin" >> ~/.profile
Then finally load the new path:

source ~/.profile
Although everything should now work, it might be wise to just log out and back in to make sure other programs also get the updated path.

2>配置好GOPATH;
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOPATH/bin

之后protoc-gen-go會放到 $GOBIN 下

3>安裝protoc 3.6.1
直接復制模式
Install Protocol Buffers v3
Install the protoc compiler that is used to generate gRPC service code. The simplest way to do this is to download pre-compiled binaries for your platform(protoc-<version>-<platform>.zip) from here: https://github.com/google/protobuf/releases

Unzip this file.
Update the environment variable PATH to include the path to the protoc binary file.

4> Install gRPC
go get -u google.golang.org/grpc

5> Install the protoc plugin for Go
go get -u github.com/golang/protobuf/protoc-gen-go

6>Download the example
You can found under the examples dir: $GOPATH/src/google.golang.org/grpc/examples

7>Build the example
helloworld.proto => helloworld.pb.go

    protoc -I helloworld/ helloworld/helloworld.proto --go_out=plugins=grpc:helloworld

8>在倆個窗口執行
go run greeter_server/main.go
go run greeter_client/main.go
以上就是go服務端/ go客戶端

=========================================================

1>安裝grpc_php_plugin等插件
1》sudo apt-get install php7.0 php7.0-dev php-pear phpunit
2》Install Composer (Linux or Mac):
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
3安裝擴展
sudo pecl install grpc
sudo pecl install grpc-1.7.0
sudo pecl install protobuf
sudo pecl install protobuf-3.4.0
update php.ini
4》安裝插件
$ git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc
$ cd grpc
$ git submodule update --init
$ make //編譯全部插件
$ make grpc_php_plugin //只編譯php插件

如果有這個報錯 defined but not used [-Werror=unused-variable]
找到Makefile,去掉其中-Werror ,重新編譯。

5》 find php example
cd examples/php (grpc/examples/php)

6》helloworld.proto => hello.world.pb.go
./greeter_proto_gen.sh

7》執行client之前,需要引包
composer install

8》服務端是go,現在客戶端在php
./run_greeter_client.sh

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

惠来县| 平远县| 崇仁县| 邛崃市| 石台县| 苗栗县| 垫江县| 安泽县| 广元市| 和林格尔县| 巴中市| 铁力市| 临朐县| 淄博市| 青川县| 沙湾县| 邮箱| 安徽省| 平潭县| 枣庄市| 旺苍县| 镇巴县| 久治县| 和静县| 独山县| 邵阳市| 奉新县| 鸡东县| 清原| 莒南县| 肃南| 泰来县| 千阳县| 华容县| 阜新| 梁山县| 越西县| 阜平县| 江陵县| 耿马| 芮城县|