Skip to content
Related Articles
Open in App
Not now

Related Articles

How to Install PHP GD-library on CentOS?

Improve Article
Save Article
Like Article
  • Last Updated : 29 Nov, 2022
Improve Article
Save Article
Like Article

GD is an open-source code library that helps to create and manipulate PNG, JPEG, and GIF images in PHP. GD is commonly used for the development of websites. Image resizing, cropping, drawing, and adding effects to dynamic rendering can easily be done with its help. Picture handling and GD capacities are utilized to make and control picture records in various picture designs including GIF, PNG, JPEG, WBMP, and XPM.

Important Features of GD

  1. We can create thumbnail images from very large images without any distortion.
  2. Resampling, Resizing, Cropping, Copying, and converting images to other extensions can also be done with its help.
  3. Line and Shape drawing, Filter, and Blending.

Installing PHP GD in CentOS

If the PHP is not installed on CentOS or if we want to install the latest version follow the steps below:

Pre Requisites

  • The yum package manager (by default included).
  • Terminal with root privilege.

For demonstration, we are installing PHP 7.2 as it is an older and stable version and most of the repositories will support an older version.

Step 1: Enable Software Repositories. By default, the repositories that contain the PHP packages are not included in the yum package manager. Therefore we should enable software repositories so that they can be accessed. Install the yum-utils package by typing the command below:

yum install yum-utils –y



Enable the epel-release repository,

yum install epel-release –y



Type the commands below to add the following software repositories that contain the PHP packages:

yum install



Step 2: Enable the added PHP Repository. Now using the yum-config-manager we configure our system to install PHP. It will configure the installer to move to the repository of the PHP version. Type the command below to configure,

yum-config-manager ––enable remi–php72

Installing PHP and PHP GD and Other Dependencies

Now to install PHP, PHP GD, and other modules and add-ons that help PHP integrate with your local server configuration type the command below.

yum install php php-gd php-common php-opcache php-mcrypt php-cli php-curl php-mysql –y

Output Screen 1:



Output Screen 2:



The command above will install PHP and PHP GD along with other modules that provide basic functionality to PHP. 

Output Screen 3:



My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!