Skip to content

GD 库缺少 Freetype Support #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
monsterxcn opened this issue Aug 25, 2020 · 0 comments
Open

GD 库缺少 Freetype Support #5

monsterxcn opened this issue Aug 25, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@monsterxcn
Copy link

Hi 我最近尝试使用 metowolf/docker-lemp 来部署网站服务,在 PHP 容器中使用 composer 安装了项目依赖,但是出现报错 Fatal error

Uncaught Error: Call to undefined function imagettfbbox() in /var/www/xxx/vendor/gregwar/captcha/src/Gregwar/Captcha/CaptchaBuilder.php:323

之前我用 oneinstack/oneinstack 环境部署的相同项目没有问题。搜索后我发现可能是由于 Docker 中使用的 PHP GD 库缺少 Freetype 支持,请问这是意料之中的情况吗?

Dockerfile 中我看到似乎安装了 freetype 等支持,但是 print_r(gd_info()) 却告知没有 Freetype Support,不清楚问题出在什么地方。我尝试了 metowolf/php 镜像的 latest 7.4.7 7.4.6 三个版本也都出现此错误。

以下是我觉得可能有帮助的信息:

# php -r 'print_r(gd_info());'

Array
(
    [GD Version] => bundled (2.1.0 compatible)
    [FreeType Support] => 
    [GIF Read Support] => 1
    [GIF Create Support] => 1
    [JPEG Support] => 
    [PNG Support] => 1
    [WBMP Support] => 1
    [XPM Support] => 
    [XBM Support] => 1
    [WebP Support] => 
    [BMP Support] => 1
    [TGA Read Support] => 1
    [JIS-mapped Japanese Font Support] => 1
)

# php -i

Configure Command =>  './configure'  '--build=x86_64-linux-musl' '--with-config-file-path=/usr/local/etc/php'
  '--with-config-file-scan-dir=/usr/local/etc/php/conf.d' '--enable-option-checking=fatal' '--with-mhash' '--enable-ftp'
  '--enable-mbstring' '--enable-mysqlnd' '--with-password-argon2' '--with-sodium=shared' '--with-curl' '--with-libedit'
  '--with-openssl' '--with-zlib' '--with-pear' '--enable-fpm' '--with-fpm-user=www-data' '--with-fpm-group=www-data'
  '--disable-cgi' 'build_alias=x86_64-linux-musl'

...

gd

GD Support => enabled
GD Version => bundled (2.1.0 compatible)
GIF Read Support => enabled
GIF Create Support => enabled
PNG Support => enabled
libPNG Version => 1.6.37
WBMP Support => enabled
XBM Support => enabled
JIS-mapped Japanese Font Support => enabled
BMP Support => enabled
TGA Read Support => enabled

Directive => Local Value => Master Value
gd.jpeg_ignore_warning => 1 => 1

...

下面是此前使用的 Oneinstack 环境 PHP 配置(安装了好多不必要的...

# php -i

Configure Command =>  './configure'  '--prefix=/usr/local/php' '--with-config-file-path=/usr/local/php/etc'
  '--with-config-file-scan-dir=/usr/local/php/etc/php.d' '--with-fpm-user=www' '--with-fpm-group=www' '--enable-fpm'
  '--enable-opcache' '--disable-fileinfo' '--enable-mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd'
  '--with-iconv-dir=/usr/local' '--with-freetype' '--with-jpeg' '--with-zlib' '--enable-xml' '--disable-rpath' '--enable-bcmath'
  '--enable-shmop' '--enable-exif' '--enable-sysvsem' '--enable-inline-optimization' '--with-curl=/usr/local/curl'
  '--enable-mbregex' '--enable-mbstring' '--with-password-argon2' '--with-sodium=/usr/local' '--enable-gd'
  '--with-openssl=/usr/local/openssl' '--with-mhash' '--enable-pcntl' '--enable-sockets' '--with-xmlrpc' '--enable-ftp'
  '--enable-intl' '--with-xsl' '--with-gettext' '--with-zip=/usr/local' '--enable-soap' '--disable-debug'
  'PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:'

...

gd

GD Support => enabled
GD Version => bundled (2.1.0 compatible)
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Version => 2.8.0
GIF Read Support => enabled
GIF Create Support => enabled
JPEG Support => enabled
libJPEG Version => 6b
PNG Support => enabled
libPNG Version => 1.5.13
WBMP Support => enabled
XBM Support => enabled
BMP Support => enabled
TGA Read Support => enabled

Directive => Local Value => Master Value
gd.jpeg_ignore_warning => 1 => 1

...

我还看到 docker-library/php#926docker-library/php#1047 有人提到 docker-php-ext-install 的特性、扩展安装顺序等,但是我不太理解该做何修改。

我将继续学习,如果有时间回复的话十分感谢!

@metowolf metowolf added the enhancement New feature or request label Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants