install or enable php's gd extension code example

Example 1: install gd extension php ubuntu

#install gd extension, 7.4 replace it with your version
sudo apt-get install php7.4-gd
#check if installed
php -m | grep gd
#restart your web server 
sudo service apache2 restart
or
sudo service nginx restart

Example 2: Install or enable PHP's gd extension

apt-get install php-gd

Example 3: centos :Install or enable PHP gd extension.

yum install gd gd-devel php-gd
and then restart apache:
service httpd restart

Example 4: how to get php ext-gd with

[gd]
extension=/path/to/gd.so # use the gd.so absolute path here