Docker为PHP安装gd扩展
安装扩展库的通常命令
docker-php-ext-install 扩展库名
安装gd库需要特殊照顾,步骤如下
//进入PHP容器
//更新软件源
apt update
//安装各种库
apt install -y libwebp-dev libjpeg-dev libpng-dev libfreetype6-dev
//解压源码
docker-php-source extract
//进入gd源码文件夹
cd /usr/src/php/ext/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
//查看是否成功安装gd扩展
php -m | grep gd
//重启容器
let the world have no hard-to-write code ^-^