参考文章:https://blog.youkuaiyun.com/bbwangj/article/details/81474915
当前环境:arm64v8/php:7.4.14-fpm
进入php容器执行以下步骤
# 安装所需依赖
root@80d3844c2bb7:/var/www/html# apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng-dev
# 查看freetype2库目录
root@80d3844c2bb7:/var/www/html# ls /usr/include/freetype2/
freetype ft2build.h
# 配置gd库编译项
root@80d3844c2bb7:/var/www/html# docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/
# 安装gd库
root@80d3844c2bb7:/var/www/html# docker-php-ext-install gd
# 使用gd库扩展
root@80d3844c2bb7:/var/www/html# docker-php-ext-enable gd
docker-php-ext-configure --help
root@80d3844c2bb7:/var/www/html# docker-php-ext-configure --help
usage: /usr/local/bin/docker-php-ext-configure ext-name [configure flags]
ie: /usr/local/bin/docker-php-ext-configure gd --with-jpeg-dir=/usr/local/something
Possible values for ext-name:
bcmath bz2 calendar ctype curl dba dom enchant exif ffi fileinfo filter ftp gd gettext gmp hash iconv imap intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer xml xmlreader xmlrpc xmlwriter xsl zend_test zip
Some of the above modules are already compiled into PHP; please check
the output of "php -i" to see which modules are already loaded.
docker-php-ext-configure gd --help
root@80d3844c2bb7:/var/www/html# docker-php-ext-configure gd --help
Configuring for:
PHP Api Version: 20190902
Zend Module Api No: 20190902
Zend Extension Api No: 320190902
`configure' configures this package to adapt to many