官方GitHub:https://github.com/php-amqp/php-amqp
环境依赖安装
dnf install cmake make -y
1.安装rabbitmq-c
cd /usr/local/src/
wget https://github.com/alanxz/rabbitmq-c/archive/refs/tags/v0.14.0.tar.gz
tar xvf v0.14.0.tar.gz
cd rabbitmq-c-0.14.0/
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/rabbitmq-c-0.14.0 ..
cmake --build . --target install
ln -sv /usr/local/rabbitmq-c-0.14.0/lib64 /usr/local/rabbitmq-c-0.14.0/lib
2.安装php-amqp
cd /usr/local/src/
wget https://github.com/php-amqp/php-amqp/archive/refs/tags/v2.1.2.tar.gz
tar xvf v2.1.2.tar.gz
cd php-amqp-2.1.2/phpize
./configure --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c-0.14.0/
make -j4
make install
3.添加扩展到配置文件
echo -e '; Enable redis extension module\nextension=amqp' > /etc/php.d/20-amqp.ini
重启 php-fpm 即可