1. 安装依赖 libpng、libzip、zlib、freetype、libgd、libjpeg
libpng
wget http://jaist.dl.sourceforge.net/project/libpng/libpng16/1.6.31/libpng-1.6.31.tar.gztar -xzvf libpng-1.6.31.tar.gzcd libpng-1.6.31./configure --prefix=/usr/local/libpng --enable-sharedmakemake install
libzip
wget https://nih.at/libzip/libzip-1.2.0.tar.gztar -zxvf libzip-1.2.0.tar.gzcd libzip-1.2.0./configuremakemake install
zlib
wget http://www.zlib.net/zlib-1.2.11.tar.gztar -xzvf zlib-1.2.11.tar.gzcd zlib-1.2.11./configure --prefix=/usr/local/zlib --enable-sharedmakemake install
freetype
wget https://download.savannah.gnu.org/releases/freetype/freetype-2.10.1.tar.gztar -xzvf freetype-2.10.1.tar.gzcd freetype-2.10.1./configure --prefix=/usr/local/freetype --enable-sharedmakemake install
libgd
wget https://github.com/libgd/libgd/releases/download/gd-2.2.3/libgd-2.2.3.tar.gztar -xzvf libgd-2.2.3.tar.gzcd libgd-2.2.3./configure --enable-sharedmakemake installmake cleanmake distclean
libjpeg
wget http://www.ijg.org/files/jpegsrc.v9d.tar.gztar -xzvf jpegsrc.v9d.tar.gzcd jpeg-9d./configure --prefix=/usr/local/libjpeg --enable-sharedmakemake install
2. 进入PHP目录安装扩展
cd ~/php-7.4.19/llcd ext/cd gd/ll/usr/local/php74/bin/phpize ./configure ---enable-gd --with-php-config=/usr/local/php74/bin/php-config --with-jpeg=/usr/local/libjpeg --with-freetype=/usr/local/freetype makemake install
来源地址:https://blog.csdn.net/weixin_39857866/article/details/125819084