需要先安装 Rabbitmq-c 。
地址:https://github.com/alanxz/rabbitmq-c/releases
这里选 0.8.0 的版本,再之后的版本都是需要使用 cmake 安装。
wget https://github.com/alanxz/rabbitmq-c/releases/download/v0.8.0/rabbitmq-c-0.8.0.tar.gz tar zxvf rabbitmq-c-0.8.0.tar.gz cd rabbitmq-c-0.8.0/ ./configure --prefix=/usr/local/rabbitmq-c-0.8.0 make && make install
php扩展下载地址 https://pecl.php.net/package/amqp
wget https://pecl.php.net/get/amqp-1.10.0.tgz tar zxvf amqp-1.10.0.tgz cd amqp-1.10.0/ #这里是PHP路径下的phpize,根据各自环境安装地址运行 /usr/bin/phpize #--with-librabbitmq-dir 填写上面 rabbitmq-c 的安装地址 ./configure --with-php-config=/usr/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c-0.8.0 make && make install
修改配置文件,添加 amqp 扩展。 vi /etc/php.ini
添加 extension = amqp.so
查看 php -m 里面有 amqp 则成功完成安装。
PHP 需要重启才能生效
© 2015-2024 杭州极速互联科技有限公司 版权所有 浙ICP备17047587号-4 浙公网安备33010502005096 增值电信业务经营许可证:浙B2-20190875