首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Centos 7.2 php 7.3 -无法加载动态库“gd”

Centos 7.2 php 7.3 -无法加载动态库“gd”
EN

Stack Overflow用户
提问于 2022-02-26 10:04:32
回答 1查看 1.1K关注 0票数 1

我安装了php-gd,然后检查是否安装如下

代码语言:javascript
运行
复制
[root@LP01-Dev ~]# php -v              // checking before installing gd
PHP 7.3.33 (cli) (built: Nov 16 2021 11:18:28) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies
[root@LP01-Dev ~]# php -m | grep gd    // checking before installing gd

[root@LP01-Dev ~]# yum install php-gd  // installing gd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * epel: ftp.riken.jp
 * remi-php73: ftp.riken.jp
 * remi-safe: ftp.riken.jp
Resolving Dependencies
--> Running transaction check
---> Package php-gd.x86_64 0:7.3.33-1.el7.remi will be installed
--> Processing Dependency: gd-last(x86-64) >= 2.1.1 for package: php-gd-7.3.33-1.el7.remi.x86_64
--> Processing Dependency: libgd.so.3()(64bit) for package: php-gd-7.3.33-1.el7.remi.x86_64
--> Running transaction check
---> Package gd-last.x86_64 0:2.3.3-2.el7.remi will be installed
--> Processing Dependency: libraqm.so.0()(64bit) for package: gd-last-2.3.3-2.el7.remi.x86_64
--> Running transaction check
---> Package libraqm.x86_64 0:0.7.0-4.el7 will be installed
--> Processing Dependency: libfribidi.so.0()(64bit) for package: libraqm-0.7.0-4.el7.x86_64
--> Running transaction check
---> Package fribidi.x86_64 0:1.0.2-0.el7.remi will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================
 Package                 Arch                   Version                              Repository                  Size
======================================================================================================================
Installing:
 php-gd                  x86_64                 7.3.33-1.el7.remi                    remi-php73                  85 k
Installing for dependencies:
 fribidi                 x86_64                 1.0.2-0.el7.remi                     remi-safe                   79 k
 gd-last                 x86_64                 2.3.3-2.el7.remi                     remi-safe                  138 k
 libraqm                 x86_64                 0.7.0-4.el7                          epel                        15 k

Transaction Summary
======================================================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 317 k
Installed size: 948 k
Is this ok [y/d/N]: y
Downloading packages:
(1/4): php-gd-7.3.33-1.el7.remi.x86_64.rpm                                                     |  85 kB  00:00:00
(2/4): fribidi-1.0.2-0.el7.remi.x86_64.rpm                                                     |  79 kB  00:00:00
(3/4): libraqm-0.7.0-4.el7.x86_64.rpm                                                          |  15 kB  00:00:00
(4/4): gd-last-2.3.3-2.el7.remi.x86_64.rpm                                                     | 138 kB  00:00:00
----------------------------------------------------------------------------------------------------------------------
Total                                                                                 956 kB/s | 317 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : fribidi-1.0.2-0.el7.remi.x86_64                                                                    1/4
  Installing : libraqm-0.7.0-4.el7.x86_64                                                                         2/4
  Installing : gd-last-2.3.3-2.el7.remi.x86_64                                                                    3/4
  Installing : php-gd-7.3.33-1.el7.remi.x86_64                                                                    4/4
  Verifying  : gd-last-2.3.3-2.el7.remi.x86_64                                                                    1/4
  Verifying  : php-gd-7.3.33-1.el7.remi.x86_64                                                                    2/4
  Verifying  : libraqm-0.7.0-4.el7.x86_64                                                                         3/4
  Verifying  : fribidi-1.0.2-0.el7.remi.x86_64                                                                    4/4

Installed:
  php-gd.x86_64 0:7.3.33-1.el7.remi

Dependency Installed:
  fribidi.x86_64 0:1.0.2-0.el7.remi       gd-last.x86_64 0:2.3.3-2.el7.remi       libraqm.x86_64 0:0.7.0-4.el7

Complete!

在我安装gd之后,我得到了这个错误。

代码语言:javascript
运行
复制
[root@LP01-Dev ~]# php -v          // can't load gd with this warning
PHP Warning:  PHP Startup: Unable to load dynamic library 'gd' (tried: /usr/lib64/php/modules/gd (/usr/lib64/php/modules/gd: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/gd.so (/lib64/libraqm.so.0: undefined symbol: hb_ft_font_set_load_flags)) in Unknown on line 0
PHP 7.3.33 (cli) (built: Nov 16 2021 11:18:28) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies

首先,我检查是否有gd文件。

代码语言:javascript
运行
复制
[root@LP01-Dev ~]# cd /usr/lib64/php/modules/
[root@LP01-Dev modules]# ll
total 6212
-rwxr-xr-x 1 root root   24360 Nov 17 00:19 bz2.so
-rwxr-xr-x 1 root root   32408 Nov 17 00:19 calendar.so
-rwxr-xr-x 1 root root   15536 Nov 17 00:19 ctype.so
-rwxr-xr-x 1 root root   86968 Nov 17 00:19 curl.so
-rwxr-xr-x 1 root root   86064 Nov 17 00:19 exif.so
-rwxr-xr-x 1 root root 5428968 Nov 17 00:19 fileinfo.so
-rwxr-xr-x 1 root root   62048 Nov 17 00:19 ftp.so
-rwxr-xr-x 1 root root  108344 Nov 17 00:19 gd.so    # Here is!
-rwxr-xr-x 1 root root   15656 Nov 17 00:19 gettext.so
-rwxr-xr-x 1 root root   45072 Nov 17 00:19 iconv.so
-rwxr-xr-x 1 root root   44776 Nov 17 00:19 json.so
-rwxr-xr-x 1 root root  273688 Nov 17 00:19 phar.so
-rwxr-xr-x 1 root root   91576 Nov 17 00:19 sockets.so
-rwxr-xr-x 1 root root   19856 Nov 17 00:19 tokenizer.so

我想知道是否应该将该文件作为“gd”的确切名称。所以我在同一个地方把'gd.so‘文件复制到'gd’。

代码语言:javascript
运行
复制
[root@LP01-Dev modules]# cp gd.so gd
[root@LP01-Dev modules]# ll
total 6320
-rwxr-xr-x 1 root root   24360 Nov 17 00:19 bz2.so
-rwxr-xr-x 1 root root   32408 Nov 17 00:19 calendar.so
-rwxr-xr-x 1 root root   15536 Nov 17 00:19 ctype.so
-rwxr-xr-x 1 root root   86968 Nov 17 00:19 curl.so
-rwxr-xr-x 1 root root   86064 Nov 17 00:19 exif.so
-rwxr-xr-x 1 root root 5428968 Nov 17 00:19 fileinfo.so
-rwxr-xr-x 1 root root   62048 Nov 17 00:19 ftp.so
-rwxr-xr-x 1 root root  108344 Feb 26 18:27 gd          # Also here!
-rwxr-xr-x 1 root root  108344 Nov 17 00:19 gd.so
-rwxr-xr-x 1 root root   15656 Nov 17 00:19 gettext.so
-rwxr-xr-x 1 root root   45072 Nov 17 00:19 iconv.so
-rwxr-xr-x 1 root root   44776 Nov 17 00:19 json.so
-rwxr-xr-x 1 root root  273688 Nov 17 00:19 phar.so
-rwxr-xr-x 1 root root   91576 Nov 17 00:19 sockets.so
-rwxr-xr-x 1 root root   19856 Nov 17 00:19 tokenizer.so

但是出现了不同的错误。

代码语言:javascript
运行
复制
[root@LP01-Dev modules]# php -v
PHP Warning:  PHP Startup: Unable to load dynamic library 'gd' (tried: /usr/lib64/php/modules/gd (/lib64/libraqm.so.0: undefined symbol: hb_ft_font_set_load_flags), /usr/lib64/php/modules/gd.so (/lib64/libraqm.so.0: undefined symbol: hb_ft_font_set_load_flags)) in Unknown on line 0
PHP 7.3.33 (cli) (built: Nov 16 2021 11:18:28) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies

我搜索了这个错误/ like 64/libraqm.so.0:未定义的符号: hb_ft_font_set_load_flags,然后我发现有类似(几乎相同)问题的人和我一样。链接-> php-gd installed but fails to function in centos 7 (php 7.3 version)

所以我试了两个链接上的答案。

第一个。https://stackoverflow.com/a/63196532/10651708,答案是hb_ft_font_set_load_flags来自HarfBuzz,所以我试着安装它。

代码语言:javascript
运行
复制
[root@LP01-Dev modules]# yum install harfbuzz
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * epel: ftp.riken.jp
 * remi-php73: ftp.riken.jp
 * remi-safe: ftp.riken.jp
Package harfbuzz-0.9.36-1.el7.x86_64 already installed and latest version
Nothing to do

好像我已经有了..。

我试过第二个答案https://stackoverflow.com/a/62998791/10651708

代码语言:javascript
运行
复制
[root@LP01-Dev lib64]# yum provides '*/libraqm.so*'    // checking..
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * epel: ftp.riken.jp
 * remi-php73: ftp.riken.jp
 * remi-safe: ftp.riken.jp
libraqm-0.7.0-4.el7.x86_64 : Complex Textlayout Library
Repo        : epel
Matched from:
Filename    : /usr/lib64/libraqm.so.0.700.0
Filename    : /usr/lib64/libraqm.so.0



libraqm-devel-0.7.0-4.el7.x86_64 : Complex Textlayout Library
Repo        : epel
Matched from:
Filename    : /usr/lib64/libraqm.so



libraqm-0.7.0-4.el7.x86_64 : Complex Textlayout Library
Repo        : @epel
Matched from:
Filename    : /usr/lib64/libraqm.so.0.700.0
Filename    : /usr/lib64/libraqm.so.0



[root@LP01-Dev lib64]# cd ~
[root@LP01-Dev ~]# ll /usr/lib64/libraqm.so*           // checking..
lrwxrwxrwx 1 root root    18 Feb 26 18:16 /usr/lib64/libraqm.so.0 -> libraqm.so.0.700.0
-rwxr-xr-x 1 root root 19792 Jan 11  2020 /usr/lib64/libraqm.so.0.700.0

我还检查了/lib64目录中是否有libraqm.so.0文件。

代码语言:javascript
运行
复制
[root@LP01-Dev ~]# cd /lib64
[root@LP01-Dev lib64]# ll
total 100984
drwxr-xr-x.  3 root root     4096 Dec 26  2016 alsa-lib
drwxr-xr-x.  2 root root     4096 Jun 10  2014 apr-util-1
drwxr-xr-x.  2 root root     4096 Apr  7  2017 audit
.
.
.
lrwxrwxrwx   1 root root       18 Feb 26 18:16 libraqm.so.0 -> libraqm.so.0.700.0     # Here!
-rwxr-xr-x   1 root root    19792 Jan 11  2020 libraqm.so.0.700.0
.
.
.
dr-xr-xr-x.  2 root root     4096 Aug 12  2015 tls
dr-xr-xr-x.  2 root root     4096 Aug 12  2015 X11
drwxr-xr-x.  2 root root     4096 Dec 26  2016 xtables

似乎我在/usr/lib64 64和/lib64目录中都没有/lib64文件。所以我应该安装libraqm-devel?我不确定但我试过了。

代码语言:javascript
运行
复制
[root@LP01-Dev lib64]# yum install libraqm-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * epel: ftp.riken.jp
 * remi-php73: ftp.riken.jp
 * remi-safe: ftp.riken.jp
Resolving Dependencies
--> Running transaction check
---> Package libraqm-devel.x86_64 0:0.7.0-4.el7 will be installed
--> Processing Dependency: pkgconfig(fribidi) for package: libraqm-devel-0.7.0-4.el7.x86_64
--> Running transaction check
---> Package fribidi-devel.x86_64 0:0.19.4-6.el7 will be installed
--> Processing Dependency: fribidi(x86-64) = 0.19.4-6.el7 for package: fribidi-devel-0.19.4-6.el7.x86_64
--> Finished Dependency Resolution
Error: Package: fribidi-devel-0.19.4-6.el7.x86_64 (base)
           Requires: fribidi(x86-64) = 0.19.4-6.el7
           Installed: fribidi-1.0.2-0.el7.remi.x86_64 (@remi-safe)
               fribidi(x86-64) = 1.0.2-0.el7.remi
           Available: fribidi-0.19.4-6.el7.x86_64 (base)
               fribidi(x86-64) = 0.19.4-6.el7
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

我不能安装..。我应该降低性价比吗?我真的不知道..。我重新启动了,也尝试过几次重置操作系统。

我明天会找到更多的方法,但是我感到很沮丧,所以我写了这个问题。希望有人能帮我。谢谢~!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-02-26 14:43:20

Centos 7.2 php 7.3

这里的主要问题是您使用的是过时的CentOS版本:

  • 7.2于2015年发行.并且不再维护
  • 7.9是当前的,于2020年发布

因此,您需要首先更新到当前(尤其是在缺少7年安全更新的情况下)

代码语言:javascript
运行
复制
# cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)

# rpm -q php-gd gd-last fribidi libraqm harfbuzz
php-gd-7.3.33-1.el7.remi.x86_64
gd-last-2.3.3-2.el7.remi.x86_64
fribidi-1.0.2-1.el7_7.1.x86_64
libraqm-0.7.0-4.el7.x86_64
harfbuzz-1.7.5-2.el7.x86_64

# php --ri gd

gd

GD Support => enabled
GD headers Version => 2.3.3
GD library Version => 2.3.3
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
XPM Support => enabled
libXpm Version => 30411
XBM Support => enabled
WebP Support => enabled

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

软件包harfbuzz 0.9.36-1.el7.x86_64已安装和最新版本

因此,问题在于,harfbuzz在CentOS 7.4 (2017年)中被更新为1.3.2,在CentOS 7.6 (2018)中更新为1.7.5。

注意:PHP7.3也是EOL。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71275715

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档