php rabbitmq的扩展

 

1.下载:https://github.com/alanxz/rabbitmq-c/archive/v0.9.0.tar.gz

mkdir build && cd build # 这一步是在rabbitmq-c的根目录下创建一个build子目录 
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/librabbitmq .. # 这一步是让cmake根据../CMakeList.txt,即rabbitmq-c的根目录下的CMakeList.txt创建Makefile文件,Makefile文件会被创建到build目录中
cmake --build . # 这一步是真正的build rabbitmq-c库的,注意,不要漏掉结尾的点 '.'

make

make install

错误:

/usr/local/src/rabbitmq-c-0.9.0/tools/publish.c:87:23: note: each undeclared identifier is reported only once for each function it appears in
gmake[2]: *** [tools/CMakeFiles/amqp-publish.dir/publish.c.o] Error 1
gmake[1]: *** [tools/CMakeFiles/amqp-publish.dir/all] Error 2
gmake: *** [all] Error 2

解决:yum -y install popt popt-devel # 还是不成功
http://freshmeat.sourceforge.net/projects/popt,源码安装 ok

2.下载php 扩展

http://pecl.php.net/get/amqp-1.9.0.tgz
tar zvxf amqp-1.9.0.tgz #解压
cd amqp-1.9.9 #打开目录
/usr/bin/phpize
./configure --with-php-config=/usr/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/librabbitmq

make
make install
报错:
/usr/bin/ld: cannot find -lrabbitmq collect2: error: ld returned 1 exit status make: *** [amqp.la] Error 1
解决:yum install librabbitmq-devel
php -i |grep php.ini

extension=amqp.so #extension_dir自己定义
service php-fpm restart #重启

 

 

 

参考资料:https://www.cnblogs.com/spectrelb/p/6856246.html

https://www.jianshu.com/p/65490900a937

 

转载于:https://www.cnblogs.com/myvic/p/10157043.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值