Skip to content

foreverly/tp5.1-swoole-rabbitMQ

Repository files navigation

tp5.1-swoole-rabbitMQ

安装 erlang 和 rabbitMQ

安装rabbitMQ可视化插件amqp

1.windows安装

amqp下载对应的包,windows注意x86,x64,ts,nts等的区分

2.linux安装,在docker中php-fpm容器内

docker-compose exec php-fpm bash

pecl search amqp

apt-get install librabbitmq-dev

pecl install amqp 1.9.3

3.php.ini中加入

extension=amqp.so

1.dos模式下进入目录rabbitMQ\sbin执行以下命令

rabbitmq-service.bat stop

rabbitmq-service.bat install

rabbitmq-service.bat start

2.输入网址打开amqp,用户:guest,密码:guest 3.在amqp中添加新用户,用户名:admin,密码:admin,vhost:/

安装composer依赖管理包,需开启php_sockets扩展

composer require php-amqplib/php-amqplib

1.去Github下载swoole扩展源码,编译安装

phpize

./configure

make install

2.pecl安装

pecl install swoole

编译安装完后,开启swoole扩展,修改php.ini添加

extension=swoole.so

1.测试首页请求后,进入public,运行如下代码监听rabbitmq队列

php pool.php

2.或者在项目根目录使用thinkphp自定义命令行

php think SwoolePool

About

tp5.1+swoole+rabbitMQ

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published