How to install php70-gd on Ubuntu ?

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

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.