Issue
I installed php-gd and then check if is installed like this
[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!
After I installed gd, I get this error.
[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
First, I check if there is no gd file.
[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
I wondered if I should place the file as the exact name 'gd'. so I copied 'gd.so' file to 'gd' at the same place.
[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
but different error showed up.
[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
I searched about this error /lib64/libraqm.so.0: undefined symbol: hb_ft_font_set_load_flags and then I found someone had similar (almost same) problem like me. Link --> php-gd installed but fails to function in centos 7 (php 7.3 version)
So I tried two answers from the link.
First one. https://stackoverflow.com/a/63196532/10651708 The answer says hb_ft_font_set_load_flags comes from HarfBuzz so I tried to install it.
[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
Seems I already have harfbuzz..
I tried second answer https://stackoverflow.com/a/62998791/10651708
[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
I also checked if there is libraqm.so.0 file in /lib64 directory
[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
Seems I don't have libraqm.so file in both of /usr/lib64 and /lib64 directory.. So I should install libraqm-devel ? I wasn't sure but I tried.
[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
I can't install it.. Should I downgrade fribidi? I really have no idea.. I rebooted and also tried reset OS few times too..
I will find more way tomorrow but I felt so frustrated so I wrote this question.. hoping anyone can help me. Thank you~!
Solution
Centos 7.2 php 7.3
The main issue here is that you are using an outdated CentOS version:
- 7.2 was released in 2015... and is no more maintained
- 7.9 is current, released in 2020
So you need to update to current first (especially as you are missing 7 years of security updates)
# 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
Package harfbuzz-0.9.36-1.el7.x86_64 already installed and latest version
So here is the problem, harfbuzz was updated to 1.3.2 in CentOS 7.4 (2017) and to 1.7.5 in CentOS 7.6 (2018)
Notice: PHP 7.3 is also EOL.
Answered By - Remi Collet Answer Checked By - Senaida (WPSolving Volunteer)