首页 > 编程开发 > PHP    日期:2019-08-23 / 来自互联网 / 浏览

扩展使用的是allegro/php-protobuf,地址见github.

1、下载源码。

2、编译安装。

  /usr/local/php/bin/phpize
  ./configure --with-php-config=/usr/local/php/bin/php-config
  make && make install

3、执行下面的命令,生成对应的PHP类文件。

/usr/local/php/bin/php ./protoc-gen-php.php ./qcloud_notify.protofg

在第三步生成文件时,遇到下面的错误。

1、报Unable to find the protoc command.的错误。

解决办法:

1. 下载protobuf源码。(allegro/php-protobuf要求protobuf版本最低为2.6,我下载的2.6版本)

2. 编译安装。

  sh ./autogen.sh
  ./configure
  make && make install

2、提示ERROR: protoc exited with an exit status when executed with。

解决办法:

编辑src/Allegro/Protobuf/Compiler/Compiler.php文件.

找到148行

if ($return !== 0) {,

改为

if ($return != 0) {

即可。

觉得上面的内容有用吗?快来点个赞吧!

点赞() 我要打赏

温馨提示 : 本站内容来自会员投稿以及互联网,所有源码及教程均为作者总结编辑,请大家在使用过程中提前做好备份,以免发生无法预知的错误,源码类教程请勿直接用于生产环境!

 可能感兴趣的文章