docker安装PHP扩展2020-05-25

示例:

1、docker-php-ext-install pdo_mysql

2、extension=php_pdo_mysql.dll

一、docker按照PHP扩展

先删除原来的composer容器,重新执行以下命令:
docker run -it --name composer -v E:\docker\nginx\www\YYXTServer:/app --privileged=true composer <执行命令composer require php-amqplib/php-amqplib>

二、docker按照php的gd扩展


#容器中

#软件源修改为网易镜像站源在安装过程中会报错,要更改为以下源:

#echo "deb http://mirrors.ustc.edu.cn/debian stable main contrib non-free

deb-src http://mirrors.ustc.edu.cn/debian stable main contrib non-free

deb http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free

deb-src http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free

" > /etc/apt/sources.list

apt update  #更新软件源

apt install -y libwebp-dev libjpeg-dev libpng-dev libfreetype6-dev #安装各种库

docker-php-source extract #解压源码

cd /usr/src/php/ext/gd  #gd源码文件夹

docker-php-ext-configure gd --with-webp-dir=/usr/include/webp --with-jpeg-dir=/usr/include --with-png-dir=/usr/include --with-freetype-dir=/usr/include/freetype2  #准备编译

docker-php-ext-install gd  #编译安装

php -m | grep gd

你可能感兴趣的:(docker安装PHP扩展2020-05-25)