php7.4.9增加gd扩展

全部以源码编译方式为例,在centos7上操作

1、下载
https://www.php.net/distributions/php-7.4.9.tar.gz

2、准备(应该有多余的库
yum -y install patch gd-devel libxml2-devel libmcrypt-devel openldap-devel mhash-devel curl-devel libpng-devel libjpeg-devel freetype-devel sqlite-devel oniguruma-devel zlib-devel

3、编译安装

方式一:将gd静态编译到PHP中
php
cd /xxx/php-7.4.9/
./configure
--prefix=/usr/local/php
--enable-fpm
[b]--enable-gd[/b]
--with-freetype
--with-jpeg
--with-iconv
--with-zlib
--enable-xml
--disable-rpath
--enable-bcmath
--enable-shmop
--enable-sysvsem
--enable-inline-optimization
--with-curl
--enable-mbregex
--enable-mbstring
--with-openssl
--with-mhash
--enable-pcntl
--enable-sockets
--with-xmlrpc
--enable-soap  
--without-pear
--enable-ftp

make
make install

无需配置php.ini


方式二:将gd编译成扩展
cd /xxx/php-7.4.9/ext/gd
[b]/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-freetype --with-jpeg --enable-gd[/b]
make
make install

配置php.ini
[b]extension=gd[/b]