91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

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

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

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

灵武市| 图们市| 江北区| 瑞昌市| 洛扎县| 兖州市| 吉安县| 右玉县| 桂平市| 沙湾县| 襄樊市| 巴林右旗| 临清市| 漠河县| 康马县| 沈阳市| 武安市| 睢宁县| 加查县| 遂平县| 长治市| 永嘉县| 河西区| 宝山区| 东海县| 临漳县| 托克托县| 赞皇县| 拜城县| 凌海市| 门源| 巴林左旗| 尖扎县| 高清| 稷山县| 改则县| 扶余县| 湘西| 烟台市| 高尔夫| 盐津县|