Installation of PHP GD library before check the php version to install GD library.
Update the packages list available in the repositories by executing second command before that run the first command "php-v" to check which version currently running.
It may take small bit of time otherwise its depend or dependencies of library need to update.
Update the packages list available in the repositories by executing second command before that run the first command "php-v" to check which version currently running.
$ php -v
For PHP 5:$ apt-get update
apt-get install php5-gd
For PHP7.0 use (php7.1-gd, php7.2-gd and php7.3-gd are also available):$ sudo apt-get install php7.0-gd