下载libgd 官网 :https://github.com/libgd/libgd/releases
wget https://github.com/libgd/libgd/releases/download/gd-2.3.0/libgd-2.3.0.tar.gz
tar xf libgd-2.3.0.tar.gz
cd libgd-2.3.0
./configure
make && make install
进php目录
cd /usr/src
cd php-7.4.8
centos 7 php 编译
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysqli=mysqlnd --enable-pdo --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local/ --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-pcre-regex --with-external-pcre --with-zlib --with-bz2 --enable-calendar --disable-phar --with-curl --enable-dba --with-expat --enable-ftp --with-jpeg --with-png --with-zlib-dir --with-freetype --enable-gd-jis-conv --with-mhash --enable-mbstring --enable-opcache=yes --enable-pcntl --enable-xml --disable-rpath --enable-shmop --enable-sockets --with-zip --enable-bcmath --with-snmp --with-gettext --disable-rpath --with-mysqli --with-mysql-sock=/usr/local/mysql/ --enable-exif --with-openssl --with-zip --with-config-file-scan-dir=/usr/local/php/etc --enable-gd --with-external-gd --with-webp --with-jpeg --with-xpm --with-freetype
结合后
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysqli=mysqlnd --enable-pdo --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local/ --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-external-pcre --with-zlib --with-bz2 --enable-calendar --disable-phar --with-curl --enable-dba --with-expat --enable-ftp --with-jpeg --with-zlib-dir --with-freetype --enable-gd-jis-conv --with-mhash --enable-mbstring --enable-opcache --enable-pcntl --enable-xml --disable-rpath --enable-shmop --enable-sockets --with-zip --enable-bcmath --with-snmp --with-gettext --disable-rpath --disable-debug --with-mysqli --with-mysql-sock=/usr/local/mysql/ --enable-exif --with-openssl --with-zip --with-config-file-scan-dir=/usr/local/php/etc/php.d --enable-gd --with-external-gd --with-webp --with-jpeg --with-xpm --with-freetype --enable-sysvsem --enable-inline-optimization --enable-mbregex --with-password-argon2 --with-sodium --with-xmlrpc --enable-intl --with-xsl --enable-soap
最终
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysqli=mysqlnd --enable-pdo --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local/ --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-zlib --with-bz2 --enable-calendar --with-curl --enable-dba --with-expat --enable-ftp --with-jpeg --with-zlib-dir --with-freetype --enable-gd-jis-conv --with-mhash --enable-mbstring --enable-opcache --enable-pcntl --enable-xml --enable-shmop --enable-sockets --with-zip --enable-bcmath --with-snmp --with-gettext --disable-debug --with-mysqli --with-mysql-sock=/usr/local/mysql/ --enable-exif --with-openssl --with-zip --with-config-file-scan-dir=/usr/local/php/etc/php.d --enable-gd --with-webp --with-jpeg --with-xpm --with-freetype --enable-sysvsem --enable-inline-optimization --enable-mbregex --with-password-argon2 --with-sodium --with-xmlrpc --enable-intl --with-xsl --enable-soap
--with-external-gd