Is there a php-gd command for php7?

Posted December 24, 2015 282.4k views
PHPWordPressLAMP StackPHP Frameworks


i was working on my LAMP install for multiple wordpress site’s
they spoke of the command :

sudo apt-get install php5-gd

but i wanted to try and install my LAMP stack with PHP7
so i tried php7-gd but didn’t work.

is there such a code for php7 ?


1 comment

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
12 answers

Try this php 7
sudo apt-get install php7.0-gd

Try this for php 7.1
sudo apt-get install php7.1-gd

Try php7.0-gd

Hi, having trouble with installing php7.2-gd on Ubuntu 17.10, I am trying to run

sudo apt-get install php7.2-gd

on my localhost and I’m getting such error and I’m stuck with it;

The following packages have unmet dependencies:
 php7.2-gd : Depends: libjpeg62-turbo (>= 1.3.1) but it is not installable
E: Unable to correct problems, you have held broken packages.

Did anyone got the same issue and kindly let me know if there’s a fix for this? TIA!

Hi everyone. Have the same issue. Trying to install php7.3-gd on my ubuntu 14 + php7.3.3 but getting an error like:

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.3-gd
E: Couldn't find any package by regex 'php7.3-gd'

Did anybody has the same issue before?

The correct answer is it depends on the version of PHP7 you are using. If You’re using the distribution version (in my case, the version that comes with ubuntu) then the command would be:

apt-get install php-gd

If you have a custom or a newer version of PHP installed you will have to install it based on the version, for example:

apt-get install php7.0-gd

I would double your PHP version sudo PHP -v and proceed to verify the package exists for your version.

Hope this helps.

sudo apt-get install php7.0-gd


I have tried these two codes (sudo apt-get install php7.0-gd,sudo apt-get install php7.1-gd)
but still the problem is their,is their any other solution to solve this problem.

  • possibly because you are using php7.2. You can verify it by typing php -v in your terminal.

    If you are using php7.2, you can install gd library using sudo apt-get install php7.2-gd

I did an upgrade from PHP 5.3 to PHP 5.6 over PHP 7.x and had installed cs-cart whole the website was not showing images, its takes around 2 days trying to figure out how to solve the images displays. After check this post saw that’s the library for -GD was missing on upgrade.

I ran the command: sudo apt-get install php5.6-gd and it’s solved my issue.
Thank you!

Can’t find php5.6-gd on debian 9. On which system version did you sudo apt-get install php5.6-gd ?

Previous 1 2 Next