1

I am trying to deploy a Wordpress website using an AWS EC2 instance running CentOS. I am using wordpress 5.7.2, PHP 8.0.6, and Apache 2.4.46. I have gotten the website up and running successfully, but am seeing the following issue in my Site Health Status:

The required module, gd, is not installed, or has been disabled.

I know that I already have gd installed, because when I SSH into my instance and type the sudo yum info gd command, I receive the following output:

Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Available Packages
Name        : gd
Arch        : i686
Version     : 2.0.35
Release     : 27.amzn2
Size        : 149 k
Repo        : amzn2-core/2/x86_64
Summary     : A graphics library for quick creation of PNG or JPEG images
URL         : http://www.libgd.org/Main_Page
License     : MIT
Description : The gd graphics library allows your code to quickly draw images
            : complete with lines, arcs, text, multiple colors, cut and paste from
            : other images, and flood fills, and to write out the result as a PNG or
            : JPEG file. This is particularly useful in Web applications, where PNG
            : and JPEG are two of the formats accepted for inline images by most
            : browsers. Note that gd is not a paint program.

Name        : gd
Arch        : x86_64
Version     : 2.0.35
Release     : 27.amzn2
Size        : 146 k
Repo        : amzn2-core/2/x86_64
Summary     : A graphics library for quick creation of PNG or JPEG images
URL         : http://www.libgd.org/Main_Page
License     : MIT
Description : The gd graphics library allows your code to quickly draw images
            : complete with lines, arcs, text, multiple colors, cut and paste from
            : other images, and flood fills, and to write out the result as a PNG or
            : JPEG file. This is particularly useful in Web applications, where PNG
            : and JPEG are two of the formats accepted for inline images by most
            : browsers. Note that gd is not a paint program.

So then, the issue should be how to enable gd. My /etc/php.ini file does not contain any extension commands because my site is set up such that all the extension commands are found inside the /etc/php.d directory. I have a file inside that directory, /etc/php.d/20-gd.ini, that looks as follows:

; Enable gd extension module
extension=gd

This doesn't seem to work although it looks set up correctly, because when I check my phpinfo.php, it shows me that there are several other modules formatted the exact same way that are being loaded in successfully:

enter image description here

Every file inside the /etc/php.d directory except for 20-gd.ini is being parsed correctly by this set-up. I have tried manually adding the extension=gd command directly into the php.ini file and executed service httpd restart inside my EC2 instance, but that didn't change anything. I've also experimented with typing in other versions of gd such as extension=gd20 or extension=gd.so, but without any success. What could be causing this issue?

EDIT: Per the suggestion found here, I executed the php --ini command in my EC2 instance, which shows that /etc/php.d/20-gd.ini is in fact showing up:

Configuration File (php.ini) Path: /etc
Loaded Configuration File:         /etc/php.ini
Scan for additional .ini files in: /etc/php.d
Additional .ini files parsed:      /etc/php.d/20-bz2.ini,
/etc/php.d/20-calendar.ini,
/etc/php.d/20-ctype.ini,
/etc/php.d/20-curl.ini,
/etc/php.d/20-exif.ini,
/etc/php.d/20-fileinfo.ini,
/etc/php.d/20-ftp.ini,
/etc/php.d/20-gd.ini
...

So it's showing up here, but not in phpinfo() for some reason. Will try to figure out why.

1 Answers1

1

Hope you have resolved the issue, the reason for this could you have the package GD package for centos but not for PHP modules. '

For PHP 8.0 the following command should be able to install and enable the package correctly.

sudo apt-get install php8.0-gd

Please try to search for gd or php-gd with yum search all package_name.

Restarting apache after installation is recommended.

Please refer to the original source here. Original Source

Gautam Jha
  • 1,445
  • 1
  • 15
  • 24
  • Thank you for the response! I found the package you are referring to on my machine: `php-gd 8.0.6`. I tried restarting Apache, but nothing seems to have changed. I also tried changing the extension command to `extension=php-gd`, but likewise nothing seems to have changed. – Federico Scivittaro Jun 19 '21 at 18:49
  • @FedericoScivittaro try installing it, yum helped me several times while installing PHP modules, also that will automatically create a .ini file for that modules. – Gautam Jha Jun 19 '21 at 18:52
  • So I should uninstall and then reinstall it? – Federico Scivittaro Jun 19 '21 at 19:20
  • You can try that but I have even a better suggestion, can you try easyengine for the same requirement, google it basically it is developed for LEMP stack and all SSL. Please seach easyengine on google, hope that solves all these issues you are facing. – Gautam Jha Jun 19 '21 at 19:25
  • 1
    As usual, the answer was to "turn it off and back on again". `service httpd restart` didn't change anything. So instead I tried `pkill httpd` and then `service httpd start` ... and that worked! – Federico Scivittaro Jun 19 '21 at 23:03