php5.6
基于docker安装部署php5.6环境
Dockerfile
代码语言:javascript复制FROM php:5.6-fpm
RUN usermod -u 1010 www-data
COPY sources.list /etc/apt/sources.list
RUN apt-get update
# 相关依赖必须手动安装
&& apt-get install -y
libfreetype6-dev
libjpeg62-turbo-dev
libmcrypt-dev
libpng-dev
libzip-dev
# 安装扩展
&& docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr
&& docker-php-ext-install -j$(nproc) gd iconv
&& docker-php-ext-install -j$(nproc) mysqli
&& docker-php-ext-install -j$(nproc) zip
&& docker-php-ext-install -j$(nproc) pdo pdo_mysql
RUN apt-get purge -y g
&& apt-get autoremove -y
&& rm -r /var/lib/apt/lists/*
&& rm -rf /tmp/*
#COPY composer.phar /usr/local/bin/composer
#RUN chmod x /usr/local/bin/composer
RUN usermod -u 1010 www-data
EXPOSE 9000
CMD ["php-fpm"]
sources.list
代码语言:javascript复制# 原始镜像
#deb http://deb.debian.org/debian bullseye main
#deb http://security.debian.org/debian-security bullseye-security main
#deb http://deb.debian.org/debian bullseye-updates main
# 阿里云
deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
php安装swoole模块
php基于7.4版本
进入docker容器
代码语言:javascript复制# 安装
docker exec -it myblog_php_1 bash
apt-get update
apt-get install build-essential
pecl install swoole
# 下载
cd /usr/local/lib/php/extensions/no-debug-non-zts-20190902/
wget https://business.swoole.com/static/loader2.2.0/swoole_loader74.so
修改php.ini
代码语言:javascript复制extension=swoole.so
安装bcmath扩展
代码语言:javascript复制docker-php-ext-install -j$(nproc) bcmath