How to Install PHP GD-library on CentOS?
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
- We can create thumbnail images from very large images without any distortion.
- Resampling, Resizing, Cropping, Copying, and converting images to other extensions can also be done with its help.
- 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:
- 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:
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:
Please Login to comment...