2

I am trying to install moodle but it shows php-gd extension is missing/should be enabled. However the gd is already installed and latest, and when I command php -v I get the following error as indicated below.

PHP Warning:  PHP Startup: Unable to load dynamic library 'gd.so' (tried: /usr/lib64/php/modules/gd.so (/lib64/libraqm.so.0: undefined symbol: hb_ft_font_set_load_flags), /usr/lib64/php/modules/gd.so.so (/usr/lib64/php/modules/gd.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.3.17 (cli) (built: Apr 14 2020 08:29:22) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.17, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.17, Copyright (c) 1999-2018, by Zend Technologies

I did a lot of editing but I could not find a single solution. Please help

palaѕн
  • 72,112
  • 17
  • 116
  • 136
Jeff Seven
  • 21
  • 1
  • 3
  • what is the output of this command: php -m | grep gd – Random Dude May 06 '20 at 15:11
  • 1
    How did you install the gd module? – Random Dude May 06 '20 at 15:14
  • here is the ouput for rpm -qa|grep gd and i used yum install php-gdgdm-gdm-3.8.4-27.el7.x86_64 gd-last-2.3.0-1.el7.remi.x86_64 libgdither-0.6-8.el7.x86_64 php-gd-7.3.17-1.el7.remi.x86_64 gdisk-0.8.6-4.el7.x86_64 gdbm-1.10-8.el7.x86_64 libs-3.8.4-27.el7.x86_64 gd-devel-2.0.35-26.el7.x86_64 gupnp-igd-0.2.2-3.el7.x86_64 gdb-7.6.1-51.el7.x86_64 gd-2.0.35-26.el7.x86_64 pulseaudio-gdm-hooks-3.0-22.el7.x86_64 cgdcbxd-1.0.2-5.el7.x86_64 php73-php-gd-7.3.17-1.el7.remi.x86_64 libgdata-0.13.3-4.el7.x86_64 gdk-pixbuf2-2.28.2-4.el7.x86_64 @DavidHlavati – Jeff Seven May 06 '20 at 15:24
  • if i run php -m | grep gd //I GET //// 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 – Jeff Seven May 06 '20 at 15:33
  • 1
    Did you install all of the listed packages? – Random Dude May 06 '20 at 15:33
  • I would reinstall the gd package using this command: "yum install gd gd-devel php-gd" Then restart the httpd service: sudo systemctl restart httpd Finally check the result: php -m | grep gd – Random Dude May 06 '20 at 15:35
  • What are other packages? In Moodle - other extensions are all installed including soap, mbstring, zip etc and works fine – Jeff Seven May 06 '20 at 15:36
  • with yum install gd gd-devel php-gd" , it says installed and latest as follows ////Package gd-2.0.35-26.el7.x86_64 already installed and latest version Package gd-devel-2.0.35-26.el7.x86_64 already installed and latest version Package php-gd-7.3.17-1.el7.remi.x86_64 already installed and latest version – Jeff Seven May 06 '20 at 15:38
  • Do you know where is the gd.so located? The error message above says that it tries to load it from the /usr/lib64/php/modules, but it cant find it there. So maybe the issue is that it was installed to a different directory. Do you have multiple php cli versions installed? – Random Dude May 06 '20 at 15:43
  • you can list the installation locations of the package files with the -ql parameter if you install the package with the rpm command – Random Dude May 06 '20 at 15:46
  • the file is the on /usr/lib64/php/modules as indicated – Jeff Seven May 06 '20 at 15:53
  • I ran into this today in an un-updated copy of Centos 7. gd and gd-devel were up-to-date, but `harfbuzz` wasn't and needed to be manually updated to support that symbol. – Eric L. Dec 17 '20 at 00:09

2 Answers2

5

I had the same problem:

# php --version
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.2.32 (cli) (built: Jul  8 2020 07:33:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.32, Copyright (c) 1999-2018, by Zend Technologies

A quick search in google told me that hb_ft_font_set_load_flags comes from HarfBuzz (https://harfbuzz.github.io/harfbuzz-hb-ft.html).

I installed it with yum install harfbuzz, and after that the warning is gone:

php --version
PHP 7.2.32 (cli) (built: Jul  8 2020 07:33:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.32, Copyright (c) 1999-2018, by Zend Technologies
Eric Ross
  • 202
  • 2
  • 5
3

Run:

yum install libraqm-devel
[root@* ~]# yum provides '*/libraqm.so*'
Repository epel is listed more than once in the configuration
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


[root@* ~]# ll /usr/lib64/libraqm.so*
lrwxrwxrwx 1 root root    18 Jul 20 23:20 /usr/lib64/libraqm.so -> libraqm.so.0.700.0
lrwxrwxrwx 1 root root    18 Jul 18 19:00 /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

libraqm.so provided by libraqm-devel.

Install libraqm-devel will also install freetype and harfbuzz, which provide hb_ft_font_set_load_flags.

mchtech
  • 91
  • 8