Enabling/installing GD extension? --without-gd

PhpAmazon Ec2Gd

Php Problem Overview


How does one enable (or perhaps I need to install) GD when my phpinfo() output in "Configure Command" says; --without-gd ?

I also have nothing in my phpinfo() output "Core" that lists "gd"

PHP Version 5.2.4 on AWS.

Php Solutions


Solution 1 - Php

if you are on a Debian based server (such as Ubuntu) you can run the following command:

apt-get install php-gd

Then once it is complete run:

/etc/init.d/apache2 restart

This will restart your server and enable GD in PHP.

If you are on another type of system you will need to use something else (like yum install) or compile directly into PHP.

Solution 2 - Php

For PHP7.0 use (php7.1-gd, php7.2-gd, php7.3-gd andphp7.4-gd are also available):

sudo apt-get install php7.0-gd

and than restart your webserver.

For PHP8 use:

sudo apt-get install php8.0-gd

Solution 3 - Php

Check if in your php.ini file has the following line:

;extension=php_gd2.dll

if exists, change it to

extension=php_gd2.dll

and restart apache

(it works on MAC)

Solution 4 - Php

In my case (php 5.6, Ubuntu 14.04) the following command worked for me:

sudo apt-get install php5.6-gd

According to php version we need to change the php5.x-gd

Solution 5 - Php

All previous answers are correct but were not sufficient for me on ArchLinux. I also needed to edit /etc/php/php.ini and to uncomment :

;extension=gd.so 

The initial ; on the line needs to be removed. After restarting Nginx via systemctl restart nginx, I was good to go.

Solution 6 - Php

PHP7 Or PHP8 For Windows:

Check if in your php.ini file has the following line:

;extension=gd

if exists, change it to

extension=gd

if not found, Add this

extension=gd

and restart apache

(it works on WINDOWS)

Solution 7 - Php

For php7.1 do:

sudo apt-get install php7.1-gd

and restart webserver. For apache do

sudo service apache2 restart

Solution 8 - Php

If You're using php5.6 and Ubuntu 18.04 Then run these two commands in your terminal your errors will be solved definitely.

sudo apt-get install php5.6-gd

then restart your apache server by this command.

 sudo service apache2 restart

Solution 9 - Php

I've PHP 7.3 and Nginx 1.14 on Ubuntu 18.

# it installs php7.3-gd for the moment
# and restarts PHP 7.3 FastCGI Process Manager: php-fpm7.3.
sudo apt-get install php-gd

# after I've restarted Nginx
sudo /etc/init.d/nginx restart

Works!

Solution 10 - Php

In CentOS (but the same may apply to other distros too) if you install the php7x-gd module followed by Apache restart and still the php -i does not show the GD Support => enabled it might mean that the php.ini was not automatically configured to support this extension.

All you have to to is either to edit the /etc/php/php.ini or to create a /etc/php.d/gd.ini file with the following content:

[gd]
extension=/path/to/gd.so # use the gd.so absolute path here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionShuView Question on Stackoverflow
Solution 1 - PhpShaneView Answer on Stackoverflow
Solution 2 - PhpSebastian ViereckView Answer on Stackoverflow
Solution 3 - PhpLeonardo CamargoView Answer on Stackoverflow
Solution 4 - PhpVindesh MohariyaView Answer on Stackoverflow
Solution 5 - PhpAlexandre BourlierView Answer on Stackoverflow
Solution 6 - PhpMohamed HanyView Answer on Stackoverflow
Solution 7 - PhpMubashar AbbasView Answer on Stackoverflow
Solution 8 - PhpNayan ThakkarView Answer on Stackoverflow
Solution 9 - PhpPax BeachView Answer on Stackoverflow
Solution 10 - PhpEugen MihailescuView Answer on Stackoverflow