Home > Backend Development > PHP Problem > How to install rabbitmq extension in php

How to install rabbitmq extension in php

王林
Release: 2023-03-12 16:56:02
Original
3321 people have browsed it

php安装rabbitmq扩展的方法:1、安装相关依赖和erlang运行环境;2、安装amqp扩展和界面管理组件;3、启动服务,创建管理员用户;4、开放端口,登录管理后台。

How to install rabbitmq extension in php

本文操作环境:centos 7、php7、thinkpad t480电脑。

PHP安装rabbitmq扩展的步骤如下所示:

安装有关依赖

yum -y install gcc glibc-devel make ncurses-devel openssl-devel autoconf unixODBC unixODBC-devel socat
Copy after login

安装erlang运行环境

wget https://www.rabbitmq.com/releases/erlang/erlang-19.0-1.el6.x86_64.rpm
yum -y install erlang-19.0-1.el6.x86_64.rpm
Copy after login

输入erl测试是否成功 输入halt().退出

安装amqp-c

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
 
make && make install
Copy after login

安装amqp扩展

yum install epel-release
 
yum install autoconf gcc gcc-c++ librabbitmq librabbitmq-devel
 
wget https://pecl.php.net/get/amqp-1.9.4.tgz
 
tar xf amqp-1.9.4.tgz
 
cd amqp-1.9.4
 
phpize
 
./configure --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c
 
make && make install
Copy after login

安装界面管理组件

rabbitmq-plugins enable rabbitmq_management
Copy after login

启动服务

service rabbitmq-server start
Copy after login

创建管理员用户

rabbitmqctl add_user admin amqp123
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
rabbitmqctl set_user_tags admin administrator
Copy after login

开放15672端口

firewall-cmd --zone=public --add-port=15672/tcp --permanent
firewall-cmd --reload
Copy after login

登录管理后台

使用账号 admin amqp123 登录

http://IP地址:15672

推荐学习:php培训

The above is the detailed content of How to install rabbitmq extension in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template