php amqp扩展安装,php扩展AMQP,安装报错解决
发布日期:2022-02-18 13:08:08 浏览次数:10 分类:技术文章

本文共 1447 字,大约阅读时间需要 4 分钟。

接下来来安装php扩展AMQP,安装了它以后,才能用PHP操作rabbitmq。

wget https://pecl.php.net/get/amqp-1.4.0.tgz

tar -zxvf amqp-1.4.0.tgz

cd amqp-1.4.0

/lnmp/php/bin/phpize

./configure --with-php-config=/lnmp/php/bin/php-config

安装到这,就报了错:

checking for amqp files in default path… not found

configure: error: Please reinstall the librabbit-mq distribution

在网上搜了搜,找到了解决方法(http://www.cnphp6.com/archives/68356):

需要安装rabbitmq-c,rabbitmq-c是一个用于C语言的,与AMQP server进行交互的client库。

下载地址:https://github.com/alanxz/rabbitmq-c

unzip rabbitmq-c-master.zip

cd rabbitmq-c-master

autoreconf -i

./configure --prefix=/lnmp/rabbitmq-c

make

make install

额,接着安装PHP扩展AMQP

./configure --with-php-config=/lnmp/php/bin/php-config --with-amqp --with-librabbitmq-dir=/lnmp/rabbitmq-c

make && make install

草,又报错啦:

/software/amqp-1.4.0/amqp_exchange.c:515: error: incompatible type for argument 7 of ‘amqp_exchange_declare’

/lnmp/rabbitmq-c//include/amqp_framing.h:798: note: expected ‘amqp_boolean_t’ but argument is of type ‘amqp_table_t’

/software/amqp-1.4.0/amqp_exchange.c:515: error: too few arguments to function ‘amqp_exchange_declare’

make: *** [amqp_exchange.lo] Error 1

在https://github.com/pdezwart/php-amqp/issues/127找到了方法:

应该是安装的rabbitmq-c的版本太高了(安装的是 v0.6.0),下载了v0.5.2版本(https://github.com/alanxz/rabbitmq-c/releases/download/v0.5.2/rabbitmq-c-0.5.2.tar.gz),重新安装rabbitmq-c,重新安装php扩展AMQP,终于可以啦。真是一波三折啊。

在php配置文件里将扩展加上,重启一下,看phpinfo,显示如下图即安装成功。

来源:https://www.cnblogs.com/zhming26/p/6141028.html

转载地址:https://blog.csdn.net/weixin_28871097/article/details/115659368 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:php ci 调用控制器,如何从Codeigniter中的另一个控制器加载一个控制器?
下一篇:php png jpg,php如何将png转换成jpg-PHP问题

发表评论

最新留言

关注你微信了!
[***.104.42.241]2024年04月05日 20时42分36秒