71

Recently the new php7 has been released. However, when I am trying to install the gd package, the library can not be found.

I have tried through

sudo apt-get install php70-gd 

and

sudo apt-get install php70-php-gd

Does anybody have an idea if gd is available for php 7?

francisco
  • 1,387
  • 2
  • 12
  • 23
xfscrypt
  • 16
  • 5
  • 28
  • 59

6 Answers6

174

PHP7 packages for Ubuntu including php7.0-gd can be installed via PPA for PHP by Ondřej Surý:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

Next, install the desired version:

sudo apt-get install php7.0-gd
# or
sudo apt-get install php7.1-gd
# or
sudo apt-get install php7.2-gd
# or
sudo apt-get install php7.3-gd
# or
sudo apt-get install php7.4-gd

EDIT:

As MacroMan stated, under Ubuntu 16.04 you don't need to add the repository any more. Simply issuing sudo apt-get install php7.0-gd works.

Limon Monte
  • 52,539
  • 45
  • 182
  • 213
  • 13
    Under Ubuntu 16.04 you don't need to add the repository any more. Simply issuing `sudo apt-get install php7.0-gd` works – MacroMan Jun 07 '16 at 12:22
  • 1
    If you have php-7.x (eg: 7.1 use sudo apt-get install php7.1-gd) – syyu Feb 20 '17 at 23:57
19

just try

sudo apt-get install php7.0-gd 

i got it working that way. Greetings.

Emanuel
  • 191
  • 1
  • 2
16

In 2018, there is an alias package for this:

sudo apt-get install php-gd

Use this to retrieve the last version.

Majid Alaeinia
  • 962
  • 2
  • 11
  • 27
Tino Rüb
  • 799
  • 2
  • 13
  • 27
6

my php version is 7.1

sudo apt-get install php7.1-gd

this command is work for me

1

For Ubuntu 16.04.4 LTS

this is the command:

sudo apt-get install php7.0-gd

Anoop Saini
  • 307
  • 3
  • 5
1

check php verison first using

php -v

It will give version number suppose your version is 7.0.1 then use this command to install GD Library

 sudo yum install php70-gd

OR use this command depending upon server specification

sudo apt-get install php7.0-gd
SHUBHAM SINGH
  • 371
  • 3
  • 11