php+docker+swoole+rabbitmQ
目录结构如下
项目地址:/data/php-nginx-compose
php-mysqi Dockerfile文件内容
conf.d/nginx.conf
docker-compose.yml
启动项目 docker-compose up -d
停止项目 docker-compose stop
查看docker 进程
swoole 安装
进入PHP容器
docker exec -it compose-php bash
导入源地址 没有编辑命令时 使用echo 命令导入到文件
vim /etc/apt/sources.list
http://mirrors.163.com/debian/ jessie main non-free contrib
apt update
apt install vim
apt install wget
apt install git
apt install net-tools 【网络命令工具】
docker-php-ext-install sockets
docker-php-ext-install pdo_mysql
apt-get install gcc c++
pecl install -o -f igbinary \ && rm -rf /tmp/pear \ && docker-php-ext-enable igbinary
pecl install -o -f redis \ && rm -rf /tmp/pear \ && echo "extension=redis.so" > /usr/local/etc/php/conf.d/redis.ini
git clone https://github.com/swoole/swoole-src.git
find / -name phpize
/usr/local/bin/phpize
./configure
make
make install
php -i | grep php.ini
extension=swoole.so
rabbiteMq 扩展安装
安装依赖包
wget https://github.com/alanxz/rabbitmq-c/releases/download/v0.8.0/rabbitmq-c-0.8.0.tar.gz
tar -xvf 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
amqp扩展安装
wget http://pecl.php.net/get/amqp-1.9.0.tgz
tar -xvf amqp-1.9.0.tgz
cd amqp-1.9.0
/usr/local/bin/phpize
find / -name php-config
./configure --with-php-config=/usr/local/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c-0.8.0
cp rabbitmq-c-0.8.0/librabbitmq/amqp_ssl_socket.h amqp-1.9.0 【如果make make install 提示缺少amqp_ssl_socket.h 需要执行此命令】
make && make install