1

My Wordpress site was warning me that:

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

I started looking into this and found that it is disabled by default in php.ini:

;extension=gd2 

So I decided to uncomment it and restart. This didn't work, so I commented it out and restarted again. Then I realised that gd was simply not installed for the PHP version being used. So I installed it with apt:

apt-get install php8.0-gd 

After it was installed, everything was pointing towards gd being enabled - but it is still commented out in the php.ini. So, does uncommenting this line actually do anything?

I'm using Debian 12 and php-fpm8.0 if it is relevant. Thanks

4
  • Questions on Server Fault must be about managing information technology systems in a business environment. Home and end-user computing questions may be asked on Super User, and questions about development, testing and development tools may be asked on Stack Overflow. Commented Dec 11, 2023 at 18:56
  • PHP7.4 has been EOL for over a year now. You need to update to PHP 8.2 or PHP 8.3. Commented Dec 12, 2023 at 7:46
  • @RomeoNinov I am trying to manage a wordpress installation in a business environment. Apologies if it's on the wrong site, but it didn't really feel like a SO or SU question. The be clear, this question isn't about development. It's about a server configuration for a 3rd party platform. Is SF really not an apropriate place for this type of question? Commented Dec 12, 2023 at 11:38
  • @TeroKilkanen Currently Wordpress has beta support with php 8.2 and above (make.wordpress.org/core/handbook/references/…). I'm now on 8.0 and I will probably update it to 8.1 soon, but the problem in the question is exactly the same. Commented Dec 12, 2023 at 11:40

3 Answers 3

2

The default configuration for the loaded module should be there : /etc/php/7.4/fpm/conf.d/20-gd.ini

Maybe you're not looking a the right php.ini. To check the one really in used by apache or nginx, write a little phpinfo.php file with the content below and place it on the DocumentRoot :

<php? phpinfo(); 

The display it trough your browser, this will show you the configuration in use (php.ini file and all the modules) Right after the install the module should be enabled. But if you use the default version of php in Debian you would install the untagged version of the module like : apt install php-gd

5
  • I did exactly this to find the ini file in the first place. So I'm pretty sure I'm editing the correct file. What's strange is, gd seems to be working fine now but it's not enabled anywhere that I can see (unless it's just enabled by default?). Commented Dec 12, 2023 at 11:27
  • It depends on what distro you are using... and if php embed gd or not. Looking for the phpinfo tables you should find a line showing gd module loaded ( use Ctrl + F to find it on the page) Commented Dec 12, 2023 at 15:55
  • 1
    It appears that there is a configuration file enabled in fpm/conf.d/20-gd.ini and an extension line in php.ini. I'm guessing you only need the conf.d one? Commented Dec 12, 2023 at 18:28
  • 1
    yes you only need one of the two enabled. Commented Dec 20, 2023 at 15:21
  • I just fixed it by using the PHP version with it. sudo apt install php7.4-gd. Thanks Commented Sep 20, 2024 at 11:39
2

Run following command in Terminal to enable the gd module.

sudo phpenmod gd 
0

It turns out that gd was enabled in conf.d even though there is a commented out line for it in php.ini. This is why everything then worked after gd was installed on the server.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.