Docker php-fpm GD扩展库安装

1、先下载对应的php-fpm镜像并启动,然后通过 exec登入对应的容器。

2、配置该容器的下载源

cp /etc/apt/sources.list /etc/apt/sources.copy.list # 备份原始下载源数据

echo "deb http://mirrors.ustc.edu.cn/debian stable main contrib non-free" > /etc/apt/sources.list
echo "deb-src http://mirrors.ustc.edu.cn/debian stable main contrib non-free" >> /etc/apt/sources.list
echo "deb http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free" >> /etc/apt/sources.list

3、更新下载源、并下载必要的依赖

apt-get update

apt install -y libfreetype6 libwebp-dev libjpeg-dev libpng-dev

4、创建并初始化 /usr/src/php目录

docker-php-source extract

cd /usr/src/php/ext

5、配置 GD 扩展库并进行安装

docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include

docker-php-ext-install gd

6、查看 GD扩展库是否安装成功

php -m | grep gd

7、重启容器

docker restart <容器 ID>

参考链接:

https://www.cnblogs.com/yesok/p/14268728.html

https://blog.csdn.net/weixin_39654823/article/details/111731555

Docker php-fpm GD扩展库安装

上一篇:【过时】博客园中使用syntaxhighlighter插件(图文详细版本)


下一篇:css之auto值的含义