深浅模式
安装扩展
安装 PHP
的 gd
扩展
shell
docker exec -it php8 bash // 进入php容器
apt-get update // 更新源
apt-get install -y libwebp-dev libjpeg-dev libpng-dev libfreetype6-dev // 安装库
docker-php-source extract // 创建并初始化 /usr/src/php目录
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 扩展