Skip to content
Related Articles

Related Articles

How to install php70-gd on Ubuntu ?

View Discussion
Improve Article
Save Article
  • Last Updated : 18 Aug, 2020
View Discussion
Improve Article
Save Article

Graphics Draw or GD library is an open-source library for dynamic creation of images. It is used to create and manipulate image files in a variety of different image formats, including GIF, PNG, JPEG, WBMP, and XPM.

This package for PHP 7 can be installed via the PPA by Ondrej SurĂ½. To install php7.0-gd on ubuntu, using the terminal. Follow these steps 

  • First, you need to update your system with unsupported packages from this untrusted PPA by adding ppa:ondrej/php to your system’s Software Sources. This step is required only for Ubuntu 15 or less. Type the below command in your terminal and when prompted press ENTER to enable the repository
    sudo add-apt-repository ppa:ondrej/php

    Adding PPA repository to systems software sources-1

    Adding PPA repository to systems software sources-2

  • Next, update your repositories using the command 
    sudo apt-get update

    Sample output for the update command in Ubuntu

  • Now, we are ready to install the gd library for PHP. Run the below command to install the required version of php7.x-gd, where x should be replaced by the version required for you to install.
    sudo apt-get install php7.x-gd
    for php version 7.0 replace x with 0,
    sudo apt-get install php7.0-gd

    sudo apt-get install php7.4-gd command in Ubuntu

Note: PHP v7.0 is outdated and is no longer supported, so the above command to install php7.0-gd may not work. But, installing php7.4-gd will work fine. Since it is relatively newer and officially supported.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!