For Linux and Shell scripting.

PHP-GD support in Linux

1 Comment

GD support in PHP (Linux)

GD is a graphics library. Enable GD support in PHP when you want to use PHP scripts to manipulate image files.


Check if GD support is enabled already.

#rpm -q php-gd

If php-gd package is not installed install this package using yum

#yum install php-gd

Modify your php.ini file by adding the following line under “Dynamic Extensions” section of “php.ini” file.

Restart httpd service.

#service httpd restart
#/etc/init.d/httpd restart

Verify that php-gd support loaded

# php -m | less
# php -m | grep gd

You can also use phpinfo() page to verify that php-gd loaded and working perfectly.

Verify your GD support

You can use the scripts below to verify your GD support.


/* Displays details of GD support on your server */

echo ‘<div style=”margin: 10px;”>’;

echo ‘<p style=”color: #444444; font-size: 130%;”>GD is ‘;

if (function_exists(“gd_info”)) {

echo ‘<span style=”color: #00AA00; font-weight: bold;”>supported</span> by your server!</p>’;

$gd = gd_info();

foreach ($gd as $k => $v) {

echo ‘<div style=”width: 340px; border-bottom: 1px solid #DDDDDD; padding: 2px;”>’;
echo ‘<span style=”float: left;width: 300px;”>’ . $k . ‘</span> ‘;

if ($v)
echo ‘<span style=”color: #00AA00; font-weight: bold;”>Yes</span>’;
echo ‘<span style=”color: #EE0000; font-weight: bold;”>No</span>’;

echo ‘<div style=”clear:both;”><!– –></div></div>’;

} else {

echo ‘<span style=”color: #EE0000; font-weight: bold;”>not supported</span> by your server!</p>’;


echo ‘<p>by <a href=””></a></p>&#8217;;

echo ‘</div>’;


Open this from your browser. You will get a page like this.
GD is supported by your server!
GD Version Yes
FreeType Support Yes
FreeType Linkage Yes
T1Lib Support No
GIF Read Support Yes
GIF Create Support Yes
JPG Support Yes
PNG Support Yes
WBMP Support Yes
XBM Support Yes
JIS-mapped Japanese Font Support No


One thought on “PHP-GD support in Linux

  1. $author Thank you so much for a wonderful blog. It was such a great article. Have a great day!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s