参考文章:https://blog.csdn.net/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 kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. ?See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
? -h, --help ? ? ? ? ? ? ?display this help and exit
? ? ? --help=short ? ? ? ?display options specific to this package
? ? ? --help=recursive ? ?display the short help of all the included packages
? -V, --version ? ? ? ? ? display version information and exit
? -q, --quiet, --silent ? do not print `checking ...' messages
? ? ? --cache-file=FILE ? cache test results in FILE [disabled]
? -C, --config-cache ? ? ?alias for `--cache-file=config.cache'
? -n, --no-create ? ? ? ? do not create output files
? ? ? --srcdir=DIR ? ? ? ?find the sources in DIR [configure dir or `..']
Installation directories:
? --prefix=PREFIX ? ? ? ? install architecture-independent files in PREFIX
? ? ? ? ? ? ? ? ? ? ? ? ? [/usr/local]
? --exec-prefix=EPREFIX ? install architecture-dependent files in EPREFIX
? ? ? ? ? ? ? ? ? ? ? ? ? [PREFIX]
By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc. ?You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
? --bindir=DIR ? ? ? ? ? ?user executables [EPREFIX/bin]
? --sbindir=DIR ? ? ? ? ? system admin executables [EPREFIX/sbin]
? --libexecdir=DIR ? ? ? ?program executables [EPREFIX/libexec]
? --sysconfdir=DIR ? ? ? ?read-only single-machine data [PREFIX/etc]
? --sharedstatedir=DIR ? ?modifiable architecture-independent data [PREFIX/com]
? --localstatedir=DIR ? ? modifiable single-machine data [PREFIX/var]
? --runstatedir=DIR ? ? ? modifiable per-process data [LOCALSTATEDIR/run]
? --libdir=DIR ? ? ? ? ? ?object code libraries [EPREFIX/lib]
? --includedir=DIR ? ? ? ?C header files [PREFIX/include]
? --oldincludedir=DIR ? ? C header files for non-gcc [/usr/include]
? --datarootdir=DIR ? ? ? read-only arch.-independent data root [PREFIX/share]
? --datadir=DIR ? ? ? ? ? read-only architecture-independent data [DATAROOTDIR]
? --infodir=DIR ? ? ? ? ? info documentation [DATAROOTDIR/info]
? --localedir=DIR ? ? ? ? locale-dependent data [DATAROOTDIR/locale]
? --mandir=DIR ? ? ? ? ? ?man documentation [DATAROOTDIR/man]
? --docdir=DIR ? ? ? ? ? ?documentation root [DATAROOTDIR/doc/PACKAGE]
? --htmldir=DIR ? ? ? ? ? html documentation [DOCDIR]
? --dvidir=DIR ? ? ? ? ? ?dvi documentation [DOCDIR]
? --pdfdir=DIR ? ? ? ? ? ?pdf documentation [DOCDIR]
? --psdir=DIR ? ? ? ? ? ? ps documentation [DOCDIR]
System types:
? --build=BUILD ? ? configure for building on BUILD [guessed]
? --host=HOST ? ? ? cross-compile to build programs to run on HOST [BUILD]
? --target=TARGET ? configure for building compilers for TARGET [HOST]
Optional Features and Packages:
? --disable-option-checking ?ignore unrecognized --enable/--with options
? --disable-FEATURE ? ? ? do not include FEATURE (same as --enable-FEATURE=no)
? --enable-FEATURE[=ARG] ?include FEATURE [ARG=yes]
? --with-PACKAGE[=ARG] ? ?use PACKAGE [ARG=yes]
? --without-PACKAGE ? ? ? do not use PACKAGE (same as --with-PACKAGE=no)
? --with-libdir=NAME ? ? ?Look for libraries in .../NAME rather than .../lib
? --with-php-config=PATH ?Path to php-config [php-config]
? --enable-gd ? ? ? ? ? ? Include GD support
? --with-external-gd ? ? ?Use external libgd
? --with-webp ? ? ? ? ? ? GD: Enable WEBP support (only for bundled libgd)
? --with-jpeg ? ? ? ? ? ? GD: Enable JPEG support (only for bundled libgd)
? --with-xpm ? ? ? ? ? ? ?GD: Enable XPM support (only for bundled libgd)
? --with-freetype ? ? ? ? GD: Enable FreeType 2 support (only for bundled
? ? ? ? ? ? ? ? ? ? ? ? ? libgd)
? --enable-gd-jis-conv ? ?GD: Enable JIS-mapped Japanese font support (only
? ? ? ? ? ? ? ? ? ? ? ? ? for bundled libgd)
? --enable-shared=PKGS ? ?Build shared libraries default=yes
? --enable-static=PKGS ? ?Build static libraries default=yes
? --enable-fast-install=PKGS
? ? ? ? ? ? ? ? ? ? ? ? ? Optimize for fast installation default=yes
? --with-gnu-ld ? ? ? ? ? Assume the C compiler uses GNU ld default=no
? --disable-libtool-lock ?Avoid locking (might break parallel builds)
? --with-pic ? ? ? ? ? ? ?Try to use only PIC/non-PIC objects default=use both
? --with-tags=TAGS ? ? ? ?Include additional configurations automatic
Some influential environment variables:
? PKG_CONFIG ?path to pkg-config utility
? PKG_CONFIG_PATH
? ? ? ? ? ? ? directories to add to pkg-config's search path
? PKG_CONFIG_LIBDIR
? ? ? ? ? ? ? path overriding pkg-config's built-in search path
? CC ? ? ? ? ?C compiler command
? CFLAGS ? ? ?C compiler flags
? LDFLAGS ? ? linker flags, e.g. -L<lib dir> if you have libraries in a
? ? ? ? ? ? ? nonstandard directory <lib dir>
? LIBS ? ? ? ?libraries to pass to the linker, e.g. -l<library>
? CPPFLAGS ? ?(Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
? ? ? ? ? ? ? you have headers in a nonstandard directory <include dir>
? CPP ? ? ? ? C preprocessor
? ZLIB_CFLAGS C compiler flags for ZLIB, overriding pkg-config
? ZLIB_LIBS ? linker flags for ZLIB, overriding pkg-config
? PNG_CFLAGS ?C compiler flags for PNG, overriding pkg-config
? PNG_LIBS ? ?linker flags for PNG, overriding pkg-config
? WEBP_CFLAGS C compiler flags for WEBP, overriding pkg-config
? WEBP_LIBS ? linker flags for WEBP, overriding pkg-config
? JPEG_CFLAGS C compiler flags for JPEG, overriding pkg-config
? JPEG_LIBS ? linker flags for JPEG, overriding pkg-config
? XPM_CFLAGS ?C compiler flags for XPM, overriding pkg-config
? XPM_LIBS ? ?linker flags for XPM, overriding pkg-config
? FREETYPE2_CFLAGS
? ? ? ? ? ? ? C compiler flags for FREETYPE2, overriding pkg-config
? FREETYPE2_LIBS
? ? ? ? ? ? ? linker flags for FREETYPE2, overriding pkg-config
? GDLIB_CFLAGS
? ? ? ? ? ? ? C compiler flags for GDLIB, overriding pkg-config
? GDLIB_LIBS ?linker flags for GDLIB, overriding pkg-config
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to the package provider.
|